JSFiddle - React, Tailwind, and code Playground
HTML
<div class="workline"><input type="text" class="work1" id="w1" /></div>
CSS
.workline{
color: red;
position: relative;
width: 0;
}
.workline:after {
position: absolute;
background: red;
top: 15px;
left: 5px;
height: 1px;
width: 100%;
content: '';
}
.work1{
color: black;
}
JavaScript
$(document).ready(function(){
$('.workline input').bind('keyup', function() {
var latWidth = 6.5;
var varWidth = ($(this).val().length)*latWidth;
$(this).parents('.workline').css('width', varWidth);
});
});