I am debugging foreign complicated js code. There is button, when I press it, page gets reloaded, but that shouldn’t happen. When I break inside click handler, it executes completely and page repload/refresh happens after it has finished. After I exit handler, I get into jquery depth. How can I track wich piece of code makes page reload? Thanx!
Share
The problem was that the
<button>declaration didn’t include thetypeattribute. Here’s what the HTML standard says about that:A submit button’s default action is to submit the form to the server (thus reloading the page). To prevent that, you needed to either specify the
type="button"attribute on your button, or prevent the default action in your click handler.JSFiddle showing all cases.