Limit text input 1-99
HTML
<input min="1" type="text" id="quantity" name="quantity" value="1" onKeyUp="numbersonly()">
<script>
function numbersonly() {
var str = document.getElementById("quantity").value
var num = 1
var newstr = ""
for (i = 0; i < str.length; i++) {
for (ii = 1; ii < 10; ii++) {
if (str.charAt(i).indexOf(num) > -1) {
newstr += str.charAt(i)
}
num++
}
num = 1
}
if (newstr == "") {
newstr = 1
}
if (parseInt(newstr) > 99) {
newstr = 99
}
document.getElementById("quantity").value = newstr
}
</script>