JSFiddle - React, Tailwind, and code Playground

by pomeh

HTML

<a href="http://www.google.com/">Click me !</a>

<form method="get" action="http://www.google.com/">
    <input type="submit" value="Submit !" />
</form>

JavaScript

// test case for http://stackoverflow.com/questions/10283755/disable-submit-functionality-for-all-forms-on-a-html-page

// disable both links and form with one event handler
// this snippet requires jQuery 1.7+
$("body").on( "click", "a, form", function( ev ) {
    ev.preventDefault();
    console.log( "You can't go there" );
});

// if you have an older version you can do:
/*
$("body").delegate( "a, form", "click", function( ev ) {
    ev.preventDefault();
    console.log( "You can't go there neither" );
});
*/