Get the value of select tag jQuery
This question already has an answer here:
Please use this one :
If you want to get text value : like Cool and Hot then ues this one
$('#sel1 option:selected').text();
If you want to get value : like 1,2 then
$('#sel1 option:selected').val();
Through .val()
you will receive the value of the value attribute. You can fetch the text through .text()
.
Use this method on your selected option! See this answer!
Use option:selected
querySource = $("#querySource option:selected").text();
Also you may use the followings
$("#querySource option").is("selected").text()
$("#querySource").children("option").is("selected").text()
链接地址: http://www.djcxy.com/p/29290.html
下一篇: 获取选择标记jQuery的值