disabled attribute in JavaScript
There are special attributes in HTML that have no values,
such as the disabled
attribute used to disable elements. In order to set such
an attribute, the corresponding property must be assigned
the value true, and to remove it,
the value false.
Let's see in practice. Let's say we have a disabled input
html<input id="elem" disabled>
Let's output the value of the disabled
attribute of this input:
javascriptlet elem = document.querySelector('#elem');
console.log(elem.disabled); // shows true
Now let's enable it:
javascriptlet elem = document.querySelector('#elem');
elem.disabled = false;
Задание 1
Given an input and a button. By pressing the button, disable the input.
Задание 2
Given an input and two buttons. Let pressing the first button disable the input, and pressing the second one will enable it.
Задание 3
Given an input and a button. By pressing the button, find out if the input is disabled or not.