S
S
Sergey Khlopov2018-03-06 16:16:41
JavaScript
Sergey Khlopov, 2018-03-06 16:16:41

How to make a button inactive after being clicked?

Hello, please tell me, I have a submit button on the site, after clicking on it, a certain calculation occurs, then everything that is calculated goes into the database. Then the page reloads and the button becomes inactive. My problem is that if the calculation takes a long time, then the button is active while it is running, so the user can click on it many times.
Can you please tell me how to make this button inactive after clicking? I already tried to add a Jquery script, when the button was clicked, the button becomes inactive by adding disabled="disabled" to it, but then the button stopped working.
Then I tried to do something like this - in the database there is a field of type btn2 when a click on it occurs, 1 is written to this field, this is in order to understand whether the calculation has been completed or not. And I thought to check before pressing the button that if this field is 1, then it means not to perform the calculation, and if 0, then it means to execute.
Please tell me what can be done here. Button on my input

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2018-03-06
@Azperin

No need for any 1-2, use true\false

$('#el').prop('disabled', function(i, v) { return !v; });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question