JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<body>
<form id="submit_form" method="post">
<input type='number' id="name" name='number' min="0" required><br>
<input type="submit" text="Submit" >
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.19.3/dist/jquery.validate.min.js"></script>
<script>
$(document).on('input', "#number", function () {
if ($(this).val().length > 2) {
$(this).val($(this).val().slice(0, 2));
}
});
</script>
</body>
</html>