Answers for "how to disable a button in javascript for a certain amount of time"

19

javascript how to disable a button

//Using Javascript
//Disabling a html button

document.getElementById("Button").disabled = true;
//Enabling a html button

document.getElementById("Button").disabled = false;


//Using jQuery
//Disabling a html button

$('#Button').attr('disabled','disabled');
//Enabling a html button

$('#Button').removeAttr('disabled');
Posted by: Guest on November-28-2019
0

disable a button in javascript for a time period

const btn = document.getElementById("myBtn")
function myFunction() {
  btn.disabled = true;
  setTimeout(()=>{
    btn.disabled = false;
    console.log('Button Activated')}, 5000)
}
Posted by: Guest on June-25-2021

Code answers related to "how to disable a button in javascript for a certain amount of time"

Code answers related to "Javascript"

Browse Popular Code Answers by Language