JSFiddle - React, Tailwind, and code Playground

by Elvin Asadov

HTML

<input type='text' id='first' value='001019' />
<input type='text' id='second' value='002001' />

JavaScript

$.strPad = function (i, l, s) {
    var o = i.toString();
    if (!s) {
        s = '0';
    }
    while (o.length < l) {
        o = s + o;
    }
    return o;
}
$(document).ready(function () {
    var firstVal = parseFloat($('#first').val());
    var secondVal = parseFloat($('#second').val());

    $('#first').val($.strPad(firstVal + 1, 6));

});