javascript - How to get the text attribute of a dropdown -
javascript - How to get the text attribute of a dropdown -
i wondering how can retrieve text of selected
item in dropdown
using jquery
. code have retrieves value
, need text associated value
.
this code:
var stockcode = $(this).closest('li').find('.stock_code').html(); var quantity = $(this).closest('li').find('.order_amount').val(); var growers = $(this).closest('li').find('.growers').val(); var sharequantity = $(this).closest('li').find('.share_amount').val();
this html
<span class="bulk" style=""> <select name="cmp member" id="cmp member" class="growers"> <option value="0">choose grower share...</option> <option value="10">xxxxx</option> <option value="25">xxxxx</option> <option value="4">xxxxxx</option> <option value="6">xxxxxx</option> </select>
i required text @ xxxxx...
many help. must point out i've got multiple dropdowns
beingness generated dynamically need reference class
.
you have using :selected
selector along .text()
function
var growers = $(this).closest('li').find('.growers option:selcted').text();
javascript jquery html
Comments
Post a Comment