PreventDefault Not Working In Google Chrome 5 April 01, 2023 Post a Comment I want to stop a form submit button from reloading a page. This works in Firefox 3.6, Safari 5, and Opera. But Chrome 5 does not prevent the link. Here is the form. Solution 1: preventDefault() isn't the best way to prevent the browser's default behaviour in this type of DOM 0 event handler, as it certainly doesn't work in IE and possibly other browsers too. Just use return false; instead. Works in all browsers. document.onclick = handleClick; function handleClick(e){ if(!e) var e = window.event; var target = e.target || e.srcElement; switch(target.id){ case "customer-loc-sub" : findClosestStoreOne(); return false; } } Copy Solution 2: Solved this. There are another event (the entire script is about 900 lines) that was affecting this. Thanks for your help. Especially Ryan Kinal. His comment's got me to look at the problem from another angle...so to speak. Baca JugaWhy Does Not Chrome Allow Web Workers To Be Run In Javascript?Window.getcomputedstyle Not Working For Shorthand Properties In Other Browsers Except ChromeJavascript: Control Google Chrome's Open Tab Audio Volume Control Share You may like these postsHow To Force Console.log To Always Print Quotes Around StringsPlaying Sound From Inactive Browser TabSwfobject.js Won't Display Flash In Chrome (works In Edge)Why Is My Contenteditable Caret Jumping To The End In Chrome? Post a Comment for "PreventDefault Not Working In Google Chrome 5"
Post a Comment for "PreventDefault Not Working In Google Chrome 5"