简体   繁体   中英

Internet Explorer 9 and jQuery

Why doesn't this code work in Internet Explorer 9?

function calc() {
  alert('aaa');
}
$('body').delegate('input', 'change', function(){
  // In here, $(this) is the input that has changed
  calc();
});
$('body').delegate('select', 'change', function(){
  calc();
});

As far as I know, change event doesn't bubble up in IE. $.delegate only works for events that bubble. Are you saying this works for earlier versions of IE?

Are you ensuring that your JQuery calls are in the DOMReady event:

$(function() {
    $("body").delegate("input, select", "change", function() {
        calc();
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM