0

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/

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
wong2
  • 34,358
  • 48
  • 134
  • 179

1 Answers1

1

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

wong2
  • 34,358
  • 48
  • 134
  • 179
  • 1
    The DOM events spec was changed recently to make the third argument optional, Opera will follow but for now it's best to keep the third argument for best compatibility. – hallvors Oct 25 '11 at 11:02
  • 1
    This was added to Opera in version 11.60. – webinista Aug 17 '12 at 14:48