Preventdefault Not Working In Google Chrome 5 September 28, 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; functionhandleClick(e){ if(!e) var e = window.event; var target = e.target || e.srcElement; switch(target.id){ case"customer-loc-sub" : findClosestStoreOne(); returnfalse; } } CopySolution 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. Share Post a Comment for "Preventdefault Not Working In Google Chrome 5"
Post a Comment for "Preventdefault Not Working In Google Chrome 5"