Hello all,
I'm an absolute noob with jQuery and pretty crap at frontend development so here's my question.
With the following HTML
<select id="event_category_id" name="event_category_id">
<option value="">Select Category</option>
<option value="1">Category One</option>
<option value="2">Category Two</option>
<option value="3">Category Three</option>
</select>
And the following jQuery
$(document).ready(function() {
// commands go here
$('#event_category_id option').click( function(e) {
// e.stopImmediatePropagation();
alert( $('#event_category_id option:selected').text() );
});
});
I get the alert being displayed twice, with the correct text of the selection each time, for one click. It's rectified by un-commenting the stopImmediatePropagation.
So my question is,if this is event bubbling/capturing, wouldn't one of the alerts be blank as the select doesn't have text, only the option.
Or am I on the wrong track with how I think all of this works works?
Thanks for your time.