/

HTML / CSS / JavaScript Tutorial

HTML Standard attribute: disabled

[this page | pdf | back links]

The HTML disabled attribute indicates that the element or group of elements should be disabled. It applies to <button>, <fieldset>, <input>, <keygen>, <menuitem>, <optgroup>, <option>, <select> and <textarea> elements.

 

Valid attribute values (when used with <button>, <fieldset>, <input>, <keygen>, <menuitem>, <optgroup>, <option>, <select> and <textarea> elements) include:

 

Value

Description

disabled

Element (button, group of related form elements etc.) should be disabled

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Set using HTML:<br>
<input type="text" value="text1" disabled="disabled">

<br><br>Set using JavaScript:<br>
<input id="x1" type="text" value=text2>

<script>
document.getElementById("x1").disabled = true;
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile