Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript InternetExplorer9和jQuery_Javascript_Jquery_Internet Explorer 9 - Fatal编程技术网

Javascript InternetExplorer9和jQuery

Javascript InternetExplorer9和jQuery,javascript,jquery,internet-explorer-9,Javascript,Jquery,Internet Explorer 9,为什么这段代码在InternetExplorer9中不起作用 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(); }); 您

为什么这段代码在InternetExplorer9中不起作用

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();
});

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

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

据我所知,IE中不会出现更改事件。
$。委托仅适用于出现更改事件的事件。你是说这适用于早期版本的IE吗?

你能更具体一点吗?错误消息?你期望什么,你正在经历什么?没有添加-它在ff和chrome中工作,没有ie9i在ff\chrome中测试,现在老板说ie不工作,所以我寻找解决方案老板不应该告诉你它在ie中被破坏:)这说对于jquery 1.4和更新版本,更改应该是泡沫(即使在ie中也是如此),检查您的jquery版本,但是
live()
的文档中明显缺少
change
。它确实引用了一系列特定的事件类型,并且:“……以及所有冒泡的JavaScript事件”。由于live/delegate使用事件委派,因此它们似乎依赖于浏览器对事件进行冒泡的能力,而不是人为的冒泡。