2

When using for events for internet explorer we are currently using statements like this to access or change values:

window.event.cancelBubble = true;
clickX = window.event.screenX;

I was wondering how to do this cross browser or using JQuery?

1 Answer 1

2

When you provide a callback to a jquery binding function, it always take as first parameter a event that you should use, even on IE.

Don't use window.event if you're using jQuery.

Note that this is a jQuery wrapped event. For some uses you may need the originalEvent property of the event you get. Here's how you can get both in a callback :

​$('#A').click(function(e){
    console.log(e); // jquery event
    console.log(e.originalEvent); // native event
});​
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.