1<form onSubmit="return false; // Returning false stops the page from reloading">
2 <button type="submit"></button>
3</form>
1<script>
2 if ( window.history.replaceState ) {
3 window.history.replaceState( null, null, window.location.href );
4 }
5</script>
6
1Use <button type="button"> to override default submission behavior
2Use event.preventDefault() in the onSubmit event to prevent form submission