To catch the submit event of the html form element, submit()
method can be used.
<script>
$("form").submit(function () {
$("#divSubmit").fadeIn("fast").text("You have tried to submit the form")
.delay(500).fadeOut("slow");
return false;
});
</script>
Above code attaches the submit event to the form element and when the form is submitted, it writes “You have tried to submit the form” with fadeout effect (we will learn about fadeout effect in following posts). But note that as the last statement of this function is “return false”, so the form is not be submitted. To submit the form, we must write “return true” in the last.
Views: 9528 | Post Order: 85