JSFiddle - React, Tailwind, and code Playground

HTML

<div class="autotitle">xyz</div>

JavaScript

var textLength = $('.autotitle').html().length;
alert(textLength);
        if (textLength < 20) {
            alert("lenght Less than 20" );
            // Do noting 
        } else if (textLength > 20) {
            alert("lenght Greater than 20");
            $('.autotitle').css('font-size', '16px');
        }