JSFiddle - React, Tailwind, and code Playground

by WhetDawg

HTML

<input type="text" id="Test1" maxlength="2" value="12">
<input type="text" id="Test2" maxlength="2" value="99">

JavaScript

$("#Test1").change(function() {
    alert('Voila!');
    value = $(this).val().replace(/^0*/, '');

    if (value !== '') {
        value = parseInt(value, 10);
    }
    else {
        value = 1;
    }

    if (value < 1) {
        value = 1;
    }
    else if (value > 28) {
        value = 28;
    }

    event.preventDefault();
    
    $(this).val(value);

    $('#selectMonthlyDay ').attr('checked ', true);
});