开发者

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

开发者 https://www.devze.com 2023-04-12 10:11 出处:网络
I\'m trying to listen to \"oninput\" event, but something is wrong with Opera: document.getElementById(\"i1\").oninput = function(){

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://jsfiddl开发者_StackOverflowe.net/nn2zS/


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号