Thursday, May 16, 2013

Jquery: get selected item value of a dropdown - combobox element in jQuery

Use $('#{Id} :selected')

var selectedItem = $('#dropDownId :selected') // selected item object
var selectedItemText = $('#dropDownId :selected').text(); // selection text
var selectedItemId = $('#dropDownId :selected').attr('id'); // selection id

Reference:
http://stackoverflow.com/questions/2780566/to-get-selected-value-of-a-dropdown-select-element-in-jquery

No comments: