Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to disable and enable a button in jquery

// disable button using prop.

$(".button").click(function(){
  // disable button
  $(this).prop('disabled', true);

  // do something

  // below code enables button clicking after two seconds.
  setTimeout(() => {
    // enable button
  	$(this).prop('disabled', false);
  }, 2000);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #disable #enable #button #jquery
ADD COMMENT
Topic
Name
7+7 =