/* 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 );
} );
});
Demo repl.it
Top comments (0)