JSFiddle - React, Tailwind, and code Playground
HTML
Enter Minutes: <input maxlength="2" min="0" max="2" 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;
}
}
});