Reputation: 11
I have a problem with jQuery.
I have such small function
setTimeout(player_attack,500);
setTimeout(mob_attack,700);
This is triggered by button. But there is a problem. User can click it quickly and its all messing up. So i want to disable button for a while.
But this:
$('#button_name').attr("disabled","disabled");
but it works.
But when I put:
$('#button_name').removeAttr("disabled","disabled");
it doesnt work anymore.
Any suggestion?
Upvotes: 1
Views: 206
Reputation: 962
The jQuery docs recommend using the .prop()
method rather than .attr()
for changing the disabled property. (See here for more details.)
$('#button_name').prop("disabled", true); //or false
Upvotes: 0