I have something like:
<button id="button" onclick="alert('Hi')">a button</button>
I want to deactivate the button onclick action, let’s say for 5 seconds after the page loads.
Note: I don’t want to make the button disabled, just want it’s onclick action not to work untill 5 seconds.
You can simply just remove the
onclickattribute, and then put it back 5 seconds later.DEMO: http://jsfiddle.net/KX5g7/1/