I got this HTML:
<input type="number" name="eingangstuer_hoehe" min="70" max="200">
And this is the jQuery/javascript:
$("input").change(function(e) {
var $this = $(this);
var val = $this.val();
var max = $this.attr("max");
var min = $this.attr("min");
if(val > min || val < max)
{
}
else
{
if (val > max){
e.preventDefault();
$this.val(max);
}
if (val < min)
{
e.preventDefault();
$this.val(min);
}
}
});
Typing 1 or 2 will not change anything. Typing 3 - 69 will work how it supposed to. Typing everything above 199 (yes also 200) will change the value to 70..
It also won't change the values above 600