JSFiddle - React, Tailwind, and code Playground

by craigiswayne

HTML

<textarea name="" id="inputText">kyb  u uuhhhkjh kj</textarea>
	<input id="input" type="range" min="12" max="72" oninput="adjustSize(this);">

CSS

#inputText {
  width: 150px;
  height: auto;
  border: 1px solid;
  word-wrap: break-word;
}

JavaScript

function adjustSize(i){
    var o = document.getElementById('inputText');
    o.setAttribute("style","height: auto;");
    var val = i.value;
    o.style.fontSize = val + 'px';
    var fontSize = o.style.fontSize;
    o.setAttribute("style","font-size: " + fontSize + "; height: " + o.scrollHeight + "px;");  
}