Why does the button reload my entire web page?

I have a webpage I'm working on with jQuery. I get erratic behavior from some elements on my page: every time a button is clicked, any button on the page is pressed, the page is updated.

There should be some code on the page that reloads this page when the button is clicked.

I am completely obsessed with trying to figure out where the code is attached to the click handler, so I would like to know if it is possible to list the list of handlers attached to the button at runtime.

Update: After reading the answers below, I changed the line on my page:

<button id="btnSaveAndContinue" class="button" tabindex="290">Save and Continue</button>

:

<input type='button' id="btnSaveAndContinue" class="button" tabindex="290" value='Save and Continue' />
+5
source share
2 answers

. , :

$("button selector").click( function(event) {
  event.preventDefault();
});
+10

event.preventDefault() click.

. this

0

All Articles