Disable / enable a button in jquery

Some test with jquery about enable or disable a button

by Geoffrey Gazet

HTML

<div id='test'>
    <input type='button' id='buttonClickMe' value='Click me !'/>
</div>

JavaScript

$("#buttonClickMe").click(function(e) {
   $("#buttonClickMe").attr("disabled","disabled");
   $("#test").append("<small class='info'>Button disabled for 5 seconds</small>"); 
  
   setTimeout(function(){
       $(".info").remove();
       $("#buttonClickMe").removeAttr("disabled");
   }, 5000);
});