Is an exchange event happening?

I use delegation delegation to listen for the events below in the DOM, but it does not work for the onchange event in the selection window. Is the onchange event reporting or is the DOM bubbling?

Google could not find the final answer.

+35
javascript dom html
Nov 05 '08 at 13:01
source share
4 answers

According to the specification, “changes”, “send”, “reset” should bubble and “focus” and “blur”, should not bubble.

This behavior is implemented correctly in all web browsers, with the exception of IE <9, i.e. Change, send, reset make the correct bubble in IE> = 9.

See stack overflow jquery for older versions of IE

+32
Nov 05 '08 at 19:21
source share

In jQuery 1.4+, event variables appear in all browsers, including IE.

$('div.field_container').change(function() { // code here runs in all browers, including IE. }); 
+23
Jan 18 2018-11-11T00: 00Z
source share

I haven’t done this for a while, but last time I remember that Firefox recognized the event in the <SELECT> element, while IE6 only recognized events in the <OPTION> tags. As long as I remember.

IE7 did not come out at that time.

So, if that is the case, it makes sense to not even write an inline event handler and use it instead of the DOM so that you don't have a lot of dirty duplicate code.

0
Nov 05 '08 at 13:26
source share

Not sure if I have a question, but if you mean it, then NO.

 <div id="foo"> <select onchange="alert('hi');"> <option>Hello</option> <option>World</option> </select> </foo> 

Where div id = "foo" will have an onchange event ... bubbling from a select list?




in the corresponding note, just FYI, you cannot attach an event to the parameters in the selection list in IE (well, you can, but it will not fire)

-2
Nov 05 '08 at 13:22
source share