/

HTML / CSS / JavaScript Tutorial

HTML Standard attribute: min

[this page | pdf | back links]

The HTML min attribute specifies the minimum value applicable to an <input> or <meter> element.

 

Valid attribute values (when used with <input>, <meter> elements) include:

 

Value

Description

number

Minimum (numerical) value for element

date

Minimum (date) value for an <input> element

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Input value: <input type="text" id="x1" value="30">
<button onclick="myClick()">Click button to set value</button><br><br>
Set using HTML:<br>
<meter id="x2" min="10" low="30" high="70" max="90"></meter>

<br><br>Set using JavaScript:<br>
<meter id="x3"></meter>

<script>
document.getElementById("x3").setAttribute("min", "10");
document.getElementById("x3").setAttribute("low", "30");
document.getElementById("x3").setAttribute("high", "70");
document.getElementById("x3").setAttribute("max", "90");
function myClick() {
  var v = document.getElementById("x1").value;
  document.getElementById("x2").setAttribute("value", v);
  document.getElementById("x3").setAttribute("value", v);
}
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile