disable submit form

by nakhli

HTML

<form id="myform" action="/echo/html" method="post">
    <input name="username" />
    <!-- some more form fields -->
    <input id="submit" type="submit" />
</form>

JavaScript

$('#myform').submit(function(){
    $('input[type=submit]', this).attr('disabled', 'disabled');
});