如何在jquery中获取文本而不是值 [英] how to get the text instead of value in jquery
问题描述
Hi Team,
在我的月份专栏中,我有如下数据:
6月
7月
等...
i我的价值是什么?
nqiSqiEntity.Month = $('#monthSelect')。val() ;
它给了我价值
我想要的文字即:6月,7月没有价值即:来自下拉列表的1,2文本在Jquery:
i试试这个
nqiSqiEntity.Month = $('#monthSelect')。text();但是它给了我月份专栏的所有数据
请建议
如何获取文本而不是价值。
提前致谢
Harshal
Hi Team,
In my month column i have a data as follows:
june
july
and so on ...
i am getting the value
nqiSqiEntity.Month = $('#monthSelect').val();
it gives me value
I want the text ie: June,July not value ie: 1,2 of text from the dropdown in Jquery:
i have try this
nqiSqiEntity.Month = $('#monthSelect').text(); but its give me all the data from month column
Kindly suggest
how to get the text instead of value.
Thanks in advance
Harshal
推荐答案
('#monthSelect')。val() ;
它给了我价值
我想要的文字即:6月,7月没有价值即:来自下拉列表的1,2文本在Jquery:
i试试这个
nqiSqiEntity.Month =
('#monthSelect').val();
it gives me value
I want the text ie: June,July not value ie: 1,2 of text from the dropdown in Jquery:
i have try this
nqiSqiEntity.Month =
('#monthSelect' )。文本();但是它给了我月份专栏的所有数据
请建议
如何获取文本而不是价值。
提前致谢
Harshal
('#monthSelect').text(); but its give me all the data from month column
Kindly suggest
how to get the text instead of value.
Thanks in advance
Harshal
就是这样。
This is it.
nqiSqiEntity.Month =
这篇关于如何在jquery中获取文本而不是值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!