JSFiddle - React, Tailwind, and code Playground

by lchau

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.0/lodash.js"></script>
<input id="input" value="hello" />

CSS

input {
   width: 150px;
}

JavaScript

var scrollWidth = $("#input").prop("scrollWidth");
console.log("current width:", scrollWidth);

var resizer = function(event) {
    console.log(event);
    $(this).css("width", scrollWidth);
    
    console.log('ok');
    
    var width = $(this).prop("scrollWidth");
    $(this).css("width", width);
};
$("#input").on("input", resizer);
$("#input").on("keypress", function(evt) {
    console.log('keypress');
});