Preventdefault Not Working In Google Chrome 5 July 21, 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 JugaImport Not Working In ChromeImage Drawn On Canvas Not Displayed In Google ChromeChrome Extension - Access Document/page Variable From Extension Share You may like these postsDo I Need To Refresh A Page To See If The Indexed Db Was Reset?Fabric Js Custom Rotate Icon Is Not Visible In Only Iphone's Google Chrome BrowserHow To Load/build Chrome App/extension And Run ProgrammaticallySelenium - I Can't Click Button In Dialog "before You Continue" In Google Post a Comment for "Preventdefault Not Working In Google Chrome 5"
Post a Comment for "Preventdefault Not Working In Google Chrome 5"