0

为什么此代码在 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();
});
4

2 回答 2

2

据我所知,更改事件不会在 IE 中冒泡。$.delegate仅适用于冒泡的事件。你是说这适用于早期版本的 IE 吗?

于 2011-01-10T21:10:30.293 回答
0

您是否确保您的 JQuery 调用在 DOMReady 事件中:

$(function() {
    $("body").delegate("input, select", "change", function() {
        calc();
    }
});
于 2011-01-10T21:09:08.763 回答