Nate Pet Nate Pet - 6 months ago 37
jQuery Question

Get the value of a dropdown in jQuery

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


Jon Miller

Jim Smith

Jen Morsin

Jon MIller has ID of 101

Jim Smith has ID of 102

Jen Morsin has ID of 103

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();