HTML Standard attribute: value
[this page | pdf | back links]
The
HTML value attribute indicates the value of
an element. It applies to <button>, <data>, <input>, <li>, <meter>, <option>, <progress>
and <param> elements.
Valid attribute
values (when used with <button>, <input> elements)
include:
Value
|
Description
|
text
|
Initial value for
button
|
Note: for some older
browsers, if you use a <button>
element inside a <form>
element then the browser may submit the text between the <button> and </button> tags rather than the
value of its value attribute.
Valid attribute
values (when used with <data> elements)
include:
Value
|
Description
|
machine-readable
format
|
Machine-readable
content
|
Valid attribute
values (when used with <li>
elements) include:
Value
|
Description
|
integer
|
Value of a list item
(following list items will increment from that number). Only applicable to <ol>
lists
|
Valid attribute
values (when used with <meter>
elements) include:
Value
|
Description
|
number
|
Value of gauge
|
Valid attribute
values (when used with <option>
elements) include:
Value
|
Description
|
text
|
Value to be sent to
server
|
EXAMPLE:
HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML:<br>
<input type="text" value="default value">
<br><br>Created using JavaScript:<br>
<span id="element"></span>
<script>
var x = document.createElement("INPUT");
var att = document.createAttribute("value");
att.value = "default value";
x.setAttributeNode(att);
document.getElementById("element").appendChild(x);
</script>
</body>
</html>
|
NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes