Chrome Extension

Detect form submit jQuery

$("form").submit(function() {
    var val = "";
    if (val === "") {
        return false; //THIS WILL PREVENT FORM TO SUBMIT
    } else {
        return true; //THIS WILL SUBMIT THE FORM

You can check form submit event on the webpage using jQuery. We are using .submit() function to detect form submit here in the code snippet. To select form HTML element, we are using tag name 'form' and attaching .submit() function 

Search Index Data (The code snippet can also be found with below search text)

prevent form to submit jQuery
Was this helpful?
Never leave your website again in search of code snippets by installing our chrome extension.
Open Code Manager