Preventdefault Not Working In Google Chrome 5 January 15, 2024 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 JugaGoogle Chrome: Xmlhttprequest.send() Not Working While Doing PostGet Current Page Url In Chrome ExtensionAbout Script Tags Inside Form Tags Share You may like these postsHow To Detect Log Out From Fb Using Js Sdk Without Refreshing The PageIterating For Loop For Set Number Of Iterations Each Time It Is Called Until The End Of An ArrayPrevent Users From Submitting Their Own Image With Ajax?Iframe Reload Caching Issue Post a Comment for "Preventdefault Not Working In Google Chrome 5"
Post a Comment for "Preventdefault Not Working In Google Chrome 5"