RKh
RKh

Reputation: 14161

Lock a button while an AJAX call

On click of a button, I am saving the record to the database. I don't want to refresh the page, it must be handled through AJAX.

I have the code for AJAX, I just want to know how to enable/disable the Submit button?

Upvotes: 0

Views: 606

Answers (2)

Myles
Myles

Reputation: 21510

This should do the trick.

document.getElementById('submitId').disabled = true;

Upvotes: 3

cletus
cletus

Reputation: 625087

Assuming:

<input type="submit" id="submit" value="Submit">

then

var submit = document.getElementById('submit');
submit.disabled = true;

Upvotes: 1

Related Questions