Tuesday, 15 January 2013

javascript - get selected="selected" text with jquery -



javascript - get selected="selected" text with jquery -

this question has reply here:

get selected text drop-down list (select box) using jquery 23 answers

i have html code, how can text has selected="selected" alternative jquery ?

<option selected="selected" value="1">m</option> <option value="2">n</option> <option value="3">o</option> <option selected="selected" value="4">p</option> <option value="5">q</option> <option value="6">r</option> <option value="7">s</option> <option selected="selected" value="8">t</option> <option value="9">u</option> <option value="10">v</option>

thanks

well, can set them in array

var arr = $('option:selected').map(function(){ homecoming $(this).text() }).get(); // arr[0] = 1 // arr[1] = 4 // arr[2] = 8

i suppose it's multi select.

javascript jquery gettext

No comments:

Post a Comment