我有一个下拉列表,上面有一对"ID,Name".
Example
Jon Miller
Jim Smith
Jen Morsin
乔恩·米勒的身份证号码是101
When I do the followng:
var arNames = $('#Crd').val()
and I select Jon Miller, I get 101. I'd like to get Jon Miller though.
我有一个下拉列表,上面有一对"ID,Name".
Example
Jon Miller
Jim Smith
Jen Morsin
乔恩·米勒的身份证号码是101
When I do the followng:
var arNames = $('#Crd').val()
and I select Jon Miller, I get 101. I'd like to get Jon Miller though.
$('#Crd').val()
will give you the selected value of the drop down element. Use this to get the selected options text.
$('#Crd option:selected').text();