Question: am trying to prevent this form from causing the whole page to refresh. When I've searched elsewhere on here, the answer is usually to use return false; However, this is already in the code but it's still reloading the page

```
<input type="submit" name="PC13871$btnRefresh" value="Search" onclick="(function(btn){var bDisableMe=true;if(typeof(Page_ClientValidate)=='function'){bDisableMe=Page_ClientValidate('PC13871');}__doPostBack('PC13871$btnRefresh','');btn.disabled=bDisableMe;})(this);return false;" id="PC13871_btnRefresh" class="BBFormSubmitButton DirectoryFormSubmitButton"></input>

```

Anyone got any ideas? This code is generated by a CMS so I can attack it with javascript/jQuery but can't just edit the html unfortunately.

Edit: live example here - <https://community.crisis.org.uk/no-one-turned-away/election-actions/no-one-turned-away-ppc-support#constituency>

Answer: 
Elsewhere here is right: **if you return false your button won't submit**. 

Therefore:

1. either your button is not returning false, or
2. something else is submitting the form.

To check **1**, put a return false at the very beginning of the onclick statement. Then you can go moving the return until you have tested the whole onclick. 

You can also add an `[alert][1]` to ensure the code has reached your return line. Do not use console.log for this purpose, because it doesn't stop the flow.

After this, to find out **2**, you can open the console on Google Chrome and review the most likely assigned elements. Focus on the form and check at the right (on the console) the section Event Listeners. Do the same with your button.

Note: do not use `event.preventDefault()` until you are sure what (and why) is submitting the form. Doing so is not only bad practice, but you'll run into troubles in the future for sure.
```js
$("#PC13871_btnRefresh").click(function (e) {
    e.preventDefault();
    alert("Handler for .click() called.");
});
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<input type="submit" name="PC13871$btnRefresh" value="Search" onclick="(function(btn){var bDisableMe=true;if(typeof(Page_ClientValidate)=='function'){bDisableMe=Page_ClientValidate('PC13871');}__doPostBack('PC13871$btnRefresh','');btn.disabled=bDisableMe;})(this);return false;" id="PC13871_btnRefresh" class="BBFormSubmitButton DirectoryFormSubmitButton"></input>
```

Use the `e.preventDefault()`. It will cancel the default action for an input of type `submit`