JSFiddle - React, Tailwind, and code Playground

HTML

<input id="Text1" type="text" />

JavaScript

$(function () {            
    alert($('#Text1').length);
    var textBox1 = document.getElementById("Text1");
    alert(textBox1.value.length);
    
    $('#Text1').on('input', function() {
        alert($('#Text1').length);
        var textBox1 = document.getElementById("Text1");
        alert(textBox1.value.length);
    });
});