Get the value of a dropdown in jQuery

后端 未结 10 2314
臣服心动
臣服心动 2020-11-29 02:46

I have a drop down that has an \'ID, Name\' Pair.

Example

Jon Miller
Jim Smith
Jen Morsin

Jon MIller has ID of 101
Jim Smith has ID of 10

10条回答
  •  既然无缘
    2020-11-29 03:06

    $('#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();
    

提交回复
热议问题