js prevent submit button to refreshing page code example
Example 1: html prevent submit from reloading page
<form onSubmit="return false; // Returning false stops the page from reloading">
<button type="submit"></button>
</form>
Example 2: submit form javascript without refresh
event.preventDefault()