문제

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();
    }
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top