Cross Browser Event Handling And Jquery Support
Just read of ppk's web site that IE's mechanism of registering events does not set the this object to the actual element that was clicked. Instead it refers to the global window ob
Solution 1:
Using the call
method, you can set the value of this
in any function:
var element = document.getElementById('testy'),
someFunction = function () {
alert(this.id);
};
someFunction.call(element); // alerts "testy"
This is how almost every library fixes IE's stupid "this" mistake: by adding a wrapper to the listener that you pass in, so that your listener is actually called
.
Post a Comment for "Cross Browser Event Handling And Jquery Support"