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');//JS
document.getElementById("Button").disabled = !0;
document.getElementById("Button").disabled = !1;
document.querySelector('Button').disabled = !0;
document.querySelector("Button").disabled = !1;
//jQuery < 1.6
$('#Button').attr('disabled','disabled');
$('#Button').removeAttr('disabled');
//jQuery > 1.6
$('#Button').prop('disabled', !0);
$('#Button').prop('disabled', !1);
//Toggle JS
const b = document.getElementById("Button");
b.disabled=!b.disabled;
//Toggle jQuery
const b = $('#Button');
b.prop('disabled', !b.prop('disabled'));
Also in JavaScript:
- angular add debounce time before putting valu in subject next
- update nodejs ubuntu
- jquery document ready shorthand
- express file upload mv
- search with multiple field in node js mongodb
- add new element to existing json object
- javascript remove characters from beginning of string
- how to make a sprite javascript
- javascript whitespace strip
- node default version
- how to create component in reactjs
- objects are not valid as a react child
- update formgroup value angular
- read xlsx file in angular 5
- image compression in nodejs
- jquery change text
- callback in js
- javascript remove uniques from array
- javascript remove spaces at the beginning of the end of the string
- ruby on rails test if all parameters in json request are here
- javascript get the last element of json
- sort arrays according to first array js
- javascript function optional parameter
- How to parse POST requests with express nodejs