Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

disable button js

// 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: #disable #button #js
ADD COMMENT
Topic
Name
7+2 =