get the value of selected option in jquery

get the value of selected option in jquery

Postby tomrff » Thu Apr 28, 2011 1:46 pm

get the value of selected option in jquery


suppose that below is the selectbox/combobox

<select id="sel">
<option value ="1">Hi</option>
<option value="2">Hello</option>
<option value="3">Helloooooo</option>
<option value="4">ok</option>
<option value="5">Okey</option>
</select>

want to get the value of selected option, then use
$("select#sel").val();

or get the text of selected box, then use
$("#seloption:selected").text();
tomrff
 
Posts: 33
Joined: Sat Jan 08, 2011 10:12 pm

Return to JQuery

Who is online

Users browsing this forum: No registered users and 1 guest

cron