How to get the value of two selected options using jquery? -
i have following select options:
<select id="optiona"> <option> </option> <option> b </option> <option> c </option> </select> <select id="optionb"> <option> d </option> <option> e </option> <option> f </option> </select>
the following jquery code not working determine text values of each selected options:
<script type="text/javascript"> $(document).ready(function() { if($("#optiona").change() || ($("#optionb").change()) { var texta = $(this).find("#optiona option:selected").text(); var textb = $(this).find("#optionb option:selected").text(); alert( + texta + " " + textb); } }); </script>
any idea might problem?
$('#optiona, #optionb').change(function() { alert($('#optiona').val() + ' ' + $('#optionb').val()); });
Comments
Post a Comment