1

I have this little bit of code on my (mvc) site to get a piece of info through Ajax. No problem so far, at least in all browsers, but one; Firefox doesn't recognize this and goes directly to the default controller instead of the Ajax controller.

$('.navbar li a').click(function(e) { event.preventDefault();

I have been searching, but I really don't understand why Firefox is such a pain in the ass. Can someone please help me?

1 Answer 1

1

From here, "window.event is a proprietary Microsoft Internet Explorer property ...".

Change

event.preventDefault(); 

to

e.preventDefault(); 

e is a jQuery Event object, which normaizes disparate browser behaviours.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.