addEventListener(“input”, callback) doesn't work in opera?

[亡魂溺海] 提交于 2019-12-13 06:58:41

问题


I'm trying to listen to "oninput" event, but something is wrong with Opera:

document.getElementById("i1").oninput = function(){
    console.log("inputting");
};
document.getElementById("i1").addEventListener("input", function(){
    console.log("inputting");
});

The first one works, but the second one doesn't work....it this a bug of opera?
Fiddle: http://jsfiddle.net/nn2zS/


回答1:


OK, I figured out this myself, addEventListener has a 3rd parameter, it can be ignored in Chrome but not other browsers.



来源:https://stackoverflow.com/questions/7709818/addeventlistenerinput-callback-doesnt-work-in-opera

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!