Ok, so I'm pretty new to jQuery, but found this bizzare problem just now,
If we ignore jquery for a second and consider this scenario, if I have two links, as shown below, with both href and the with and onclick event. The first link will not follow href, because onclick returns false, and the second link will be caused by the fact that onclick returns true.
<a href="/page.html" onclick="return false;">Dont follow</a> <a href="/page.html" onclick="return true;">Follow</a>
It works just the hunky dory in every browser, as it should be, the fact is that as soon as I enable the jQuery script on the page, it stops working in all versions of IE, and then always follows href whether onclick returns false or not . (it continues to work perfectly in other browsers)
Now, if I add an event using jquery and call .preventDefault () on the event object instead of doing it in the old fashioned way, it behaves correctly, and you can say that you just do it? But I have a website with thousands of lines of code, and I add jquery support, I donβt want to run the risk that I can skip the already defined html onclick = "" and break the website.
I canβt understand why jQuery should prevent completely normal javascript functions from working, is this a jQuery error or am I missing something?
source share