$("#name option").click(function(){ //some code })
HTML:
<select id = "name">
<optgroup label="label1">
<option>Option a</option>
<option>Option a</option>
</optgroup>
<optgroup label="label2">
<option>Option x</option>
<option>Option y</option>
</optgroup>
</select>
I need to trigger a function whenever the user chooses an option from the select list. The problem is that it works only on firefox but doesn’t on safari nor chrome (don’t ‘ve IE to test on it).
What I seem to be missing is properly selecting the option tags within the select tag!!
Try this instead: