How to get label of select option with jQuery? How to get label of select option with jQuery? jquery jquery

How to get label of select option with jQuery?


Try this:

$('select option:selected').text();


Hi first give an id to the select as

<select id=theid><option value="test">label </option></select>

then you can call the selected label like that:

jQuery('#theid option:selected').text()


For reference there is also a secondary label attribute on the option tag:

//returns "GET THIS" when option is selected$('#selecter :selected').attr('label'); 

Html

<select id="selecter"><option value="test" label="GET THIS">Option (also called label)</option></select>