Situation:
<script>
...
$('#trollMeNow').on('click', function () {
if(condition)
{
SubmitThisFormNow();
}
else
{
BlockSubmitThisForm(); // <--- how to do that??
}
});
</script>
<input type="submit" id="trollMeNow"/>
I want to cancel submitting the form if condition returns false. How to do that?
You can do like this
$('#trollMeNow').on('click', function () {
if (condition) {
SubmitThisFormNow();
} else {
return false;
}
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments