I am looking for a way to access the id attribute of the select tag from jquery.
say i have a select tag on the form : form.php
<select id="testid">
<option value="1">1</option>
<option value="2">2</option>
</select>
from jquery I can access the option value as $(this).attr("value"). But $(this).attr("id") gets undefined.
By giving the option tag some id attribute values it works. But, is there a way around to access the id of the select tag thru $(this) object
Thanks for any help
If you are trying within
changeevent ofselectit will look like:But
$(this).attr('id')should also work.If your
$(this)point tooptionthen tryOR