FrontendDeveloper.in

JavaScript question detail

Give an example usage of the rangeOverflow property

If an element's value is greater than its max attribute then the rangeOverflow property is true. For example, the below form submission throws an error if the value is more than 100,

<input id="age" type="number" max="100" />
<button onclick="myOverflowFunction()">OK</button>
function myOverflowFunction() {
if (document.getElementById("age").validity.rangeOverflow) {
alert("The mentioned age is not allowed");
}
}
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399