Hi,

I have a simple PHP form and to prevent double data submission, once the user has clicked 'submit', I want to disable the submit button using JavaScript.

It was recommended in another thread that one could accomplish this using jQuery and the following code:

Code JavaScript:
$('input[type="submit"]').click( function() { $(this).attr('disabled','disabled'); } );

However, I also read that some browsers don't like having the submit button disabled, and that a more "elegant" way to do things would be:

Code JavaScript:
<form .. .. onsubmit="if (this.getAttribute('submitted')) return false; this.setAttribute('submitted','true');">

Ignoring the inline js for a minute, does the second method have any (dis)advantages over the first.

Does anybody have another method they use to achieve the same thing?

Thanks in advance.