Disable jQuery UI button on submit form

I have a form like this:

<form action="" method="post" id="form" name="form" enctype="multipart/form-data">
<input name="action" type="submit" value="Send" />
</form>

I am using the latest jQuery UI Button plugin. The value of the submit button MUST be sent. Is there an easy way to disable the submit button after submitting the form without using additional plugins such as "Block Submission" - http://plugins.jquery.com/project/LockSubmit

Many thanks.

0
source share
4 answers

disabled , . , disabled . setTimeout() :

$("#form").submit(function() {
    setTimeout(function() {
        // .prop() requires jQuery 1.6 or higher
        $("#form :submit").prop("disabled", true);
    }, 100);
});

:). div , .

+3

= "button"

<button type="button" >not submit</button>
+3

do you mean

$('#form').submit(function() {$(this).find('input:[type="submit"]').button({disabled:true})});

?

0
source
$('#form').submit(function() {
  $(this).find('input[type="submit"]').disable();
});
0
source

Source: https://habr.com/ru/post/1618833/


All Articles