I'm using event delegation to listen for events lower in the DOM, but it's not working for an onchange event on a select box. Does the onchange event propagate or bubble up the DOM?
Googling has failed in finding a conclusive answer.
I'm using event delegation to listen for events lower in the DOM, but it's not working for an onchange event on a select box. Does the onchange event propagate or bubble up the DOM?
Googling has failed in finding a conclusive answer.
Not sure if I get the question, but if you mean this, then NO.
<div id="foo">
<select onchange="alert('hi');">
<option>Hello</option>
<option>World</option>
</select>
</foo>
Where the div id="foo" would have an onchange event... bubbling up from the select list?
on a related note, just an FYI you can't attach an event to the options within the select list in IE (well, you can but it won't fire)
I haven't dealt with this for quite a while, but last time I did, I remember that Firefox recognized the event on the <SELECT>
element, while IE6 recognized only events on the <OPTION>
tags. As far as I remember.
IE7 was not out at that time.
So if this is the case, it makes even more sense to not write the event handler inline and apply it on DOM ready instead, lest you are going to have a lot of polluted, repetitive code.
No, "change" event does not bubble. Also, events: change, submit, reset, focus, blur do not bubble in Internet Explorer. According to specification, "focus" and "blur" should not bubble, while "change", "submit", "reset" should, this behavior implemented properly in all web browsers but IE.