How to disable Events for a while in Javascript or jQuery
- by Tarik
Hello,
I am wondering if you guys know different approach to disable an event for a while. Let me elaborate this more :
Lets say I have a div or button which has a subscriber to its onclick event. To prevent the double click when the the methods are doing some ajax things, these are the some of the ways we can do :
Disable the button till the method finishes its job
Unbind till the methods finishes its job and then bind it again.
Use some kind of flagging system like boolean so it will prevent method from working more than once.
So is there any other ways, maybe some javascript tricks or jQuery tricks which is more efficient and better practice.
Thanks in advance.