xxxxxxxxxx
<form onSubmit="return false; // Returning false stops the page from reloading">
<button type="submit"></button>
</form>
xxxxxxxxxx
<form id="form">
<input type="text" name="name" id="user-name" placeholder="Enter your name">
<input type="email" name="email id="user-email" placeholder="Enter your email">
<button id="submit" type="submit">Submit</button>
</form>
<script>
var form = document.getElementById("form");
form.addEventListener("submit",(e)=>{
e.preventDefault();
//This will prevent the form from reloading
//Because you are preventing the default
})
</script>