<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>
//jquery method //
//preventDefault() prevents the submit button
//from performing its default task like page reload
$('#form').submit(function (e) {
e.preventDefault();
});
<form onsubmit="return false">