If I have a button that sets off a jquery script is there a way to make sure the button is inactive until the script completes?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Somewhere at the beginning of your script (probably on the button’s click event), set the button’s disabled attribute to true:
Then, when complete, remove that attribute:
EDIT:
If you want to get (slightly) fancy, change the text of the button while you’re doing the work. If it’s an image button, you can change the src to a friendly ‘please wait’ message. Here’s an example of the button text version: