How can I stop user from adding number greater than max value and smaller then min value in html input(type = number)
Try this:
var max = 100; $('input').keyup(function(){ var inputValue = $(this).val(); if(inputValue > max){ alert('greater!'); $(this).val('') }
})
here is jsfiddle: http://jsfiddle.net/h07Lc0Ld/1/