What is the way to take the option that the user just clicked using "onChange" event? What I want to achieve is something like this:
<select name="my_select" onchange="checkOption(this)">
<option value="first">1</option>
<option value="second">2</option>
<option value="third">3</option>
</select>
And the function:
function checkOption(e) {
if ( jQuery(e).val() == 'second' )
alert('You just clicked the second option!')
}
However I have no idea how to access the "this" represents the current option.
I know how to do this using the jquery change()
event, however in my specific case this option isn't good.
Any help will be appreciate!
Edit: This isn't duplication since the question there is about how to use jquery's change()
event, which as I said is not what I am looking for.