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()); }); 

http://jsfiddle.net/upzkt/1/


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -