SharePoint <button> elements perform unwanted page reloads

I have an aspx page on my SharePoint site that has tags included. For some reason, every button on the page reloads the page when clicked. Even buttons without attributes (id, class, etc.) or functions will reload the page when clicked. How can I fix this problem? I can't even see what's going on in the debugger because I don't call any reload functions, so I have no idea where to place the breakpoint.

Thanks in advance for your help, I am very grateful.


source to share

2 answers

The problem here is with the button <button> tag. Its default behavior is to act like a submit button unless otherwise noted and will reload.

To keep your <button> tag add type = 'button' to the button element. I think this prevents reboots.

Or you can go with an ole <input> tag with type = 'button'. It also prevents reboots.

Or another html element with onclick event will work too.



First, search for a function called doPostback and set a breakpoint at the entry point and click the button. If you hit this breakpoint, it could mean that autorepeat is enabled for the control generating the button. However, if you run this breakpoint, you should be able to view the stack trace to figure out how you got there.

If that doesn't work, use the F12 tools in your browser, start at the HTML section and search (Ctrl-F) for the word "click". Then go to the script tab and do the same for each JavaScript file. If all of the buttons display behavior, a click event is most likely registered. Maybe with jQuery that looks like this $ ('button') to match all buttons on the page and register a click handler.

If this is not found and you have access, download one of the master pages from and temporarily replace your master page with one of them. Take a screenshot of the scripts loaded on your page. Then add them to the starter home page one at a time until the unwanted behavior appears. Then set a breakpoint on each function entry point in the script and click the button and watch where you land.



All Articles