code:
<button onclick="this.disabled=true; setTimeout(function(){this.disabled=false;},500);">click</button>
this seems to refer to the window rather than the button. How can I pass the button object in so that I can re-enable it?
I’m aware of workarounds… I could give the button an ID and then grab it again, but I’m interested to know if I can somehow pass this in.
thisis a defined by how a function is called.If you want to pass it around between functions, you have to copy it to a different variable.