scarhand scarhand - 1 year ago 134
jQuery Question

jquery disable submit button on form submission

For whatever reason, though this code does refresh the page, no fields get posted...

$('input[type=submit]', this).attr('disabled', 'disabled');

Is there a better way of coding this?

Answer Source

Your code is changing the submit action of the form. Instead of submitting, it changes the button attribute.

Try this:

$('input[type=submit]').click(function() {
    $(this).attr('disabled', 'disabled');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download