The rangeOverflow
property checks if the value entered in an input field exceeds the maximum value specified by the max
attribute.
Example:
<input type="number" id="age" min="18" max="100">
<script>
const input = document.getElementById('age');
if (input.validity.rangeOverflow) {
console.log('Value exceeds the maximum limit!');
}
</script>
Tags: intermediate, JavaScript, DOM, validation
URL: https://www.tiktok.com/@jsmentoring/photo/7465086711412854048