Answer the question
In order to leave comments, you need to log in
Why onsubmit="return false;" stops the form but onsubmit="sub()" doesn't?
Hello, I have a form with a ban on submitting data and updating the page
<form action="" onsubmit="return false;">
<input type="text" required id="test" >
<button type="submit">send</button>
</form>
return false;
through a function, nothing works - why does this happen<form action="" onsubmit="sub()">
<input type="text" required id="test" >
<button type="submit">send</button>
</form>
<script>
function sub() {
return false;
}
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question