Q
How can you disable an HTML button using JavaScript?

Answer & Solution

Answer: Option A
Solution:
To disable an HTML button using JavaScript, you can directly modify the disabled property of the button element. For example, element.disabled = true; disables the button.
Related Questions on Average

How can you set the border width of an HTML element using JavaScript?

A). element.style.borderWidth = 'width';

B). element.style.border.width = 'width';

C). element.border.width = 'width';

D). element.width = 'width';

How can you dynamically change the value of an input element using JavaScript?

A). element.value = 'New Value';

B). element.setAttribute('value', 'New Value');

C). element.setValue('New Value');

D). element.changeValue('New Value');

How can you change the style (CSS) of an HTML element using JavaScript?

A). element.style.property = 'value';

B). element.setAttribute('style', 'property: value;');

C). element.changeStyle('property: value;');

D). element.setStyle('property: value;');

How can you remove an attribute from an HTML element using JavaScript?

A). element.removeAttribute('attributeName');

B). element.attributeName = '';

C). element.removeAttribute('attributeName', 'value');

D). element.attributeName.remove();

How can you enable a disabled HTML button using JavaScript?

A). element.disabled = false;

B). element.removeAttribute('disabled');

C). element.enable();

D). element.enable = true;

How can you show a hidden HTML element using JavaScript?

A). element.style.display = 'block';

B). element.style.visibility = 'visible';

C). element.visible = true;

D). element.style.opacity = 1;

How can you set the font size of an HTML element using JavaScript?

A). element.style.fontSize = 'size';

B). element.style.fontsize = 'size';

C). element.fontsize = 'size';

D). element.size = 'size';

How can you set the font color of an HTML element using JavaScript?

A). element.style.color = 'color';

B). element.style.fontColor = 'color';

C). element.fontColor = 'color';

D). element.color = 'color';

How can you hide an HTML element using JavaScript?

A). element.style.display = 'none';

B). element.style.visibility = 'hidden';

C). element.visible = false;

D). element.style.opacity = 0;

How can you change the text content of an HTML element using JavaScript?

A). element.textContent = 'New Content';

B). element.innerText = 'New Content';

C). element.innerHTML = 'New Content';

D). element.value = 'New Content';