jQuery Form multi submit preventDefault()

antelove19

Falah Al Fitri

Posted on December 13, 2019

jQuery Form multi submit preventDefault()

Happy Coding

https://stackoverflow.com/questions/11609295/jquery-submit-multiple-forms-in-a-page/59317426#59317426

/* get all form and loop */
$( "form" ).each( function () {

    /* addEventListener onsubmit each form */
    $( this ).bind( "submit", function (event) {

        /* return false */
        event.preventDefault();

        var form = event.target;

        /* display each props of forms */
        console.log( form ); // object formHTML
        console.log( "form id: " + form.id );
        console.log( "form action: " + form.action );
        console.log( "form method: " + form.method );

    } );

});
Enter fullscreen mode Exit fullscreen mode

Demo repl.it

💖 💪 🙅 🚩
antelove19
Falah Al Fitri

Posted on December 13, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related