JSFiddle - React, Tailwind, and code Playground

by odegraciajr

HTML

Enter Minutes: <input maxlength="2" min="0" max="99" name="minutes" value="0" type="number"/>

JavaScript

$("input[name='minutes']").on('keyup keypress blur change', function(e) {
	if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
	   return false;
	}else{
		if( $(this).val().length >= parseInt($(this).attr('maxlength')) && (e.which != 8 && e.which != 0)){
			return false;
		}
	}
});