Scot Ranney • August 22, 2024
<input type="number" min="0" max="23" value="14" onkeyup=enforceMinMax(this)> Run code snippet
<script> function enforceMinMax(el) { if (el.value != "") { if (parseInt(el.value) < parseInt(el.min)) { el.value = el.min; } if (parseInt(el.value) > parseInt(el.max)) { el.value = el.max; } } } </script>
mvkb_input