Preventdefault Not Working In Google Chrome 5 November 23, 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. Baca JugaWhy Google Chrome Console Throws "syntaxerror: Unexpected Token }" When Inputted (Code To Disable Magnifier, Set Wallpaper, And Save Image In Google Chrome?Strange Chrome Extension Issue: Injecting Iframes Into Gmail Share You may like these postsJavascript Checkboxes Incorrect CalculatingDoes New Audio Preload The Sound File?How Can I Ignore Libraries Like Jquery When Profiling Javascript?Preloader Does Not Fade Out Online Post a Comment for "Preventdefault Not Working In Google Chrome 5"
Post a Comment for "Preventdefault Not Working In Google Chrome 5"