Answers for "textarea autosize label"

CSS
0

scale textarea

<textarea rows="10" style="font-size:2vw; width:100%;"></textarea>
Posted by: Guest on July-04-2020
0

javascript textarea autosize

function addAutoResize() {
  document.querySelectorAll('[data-autoresize]').forEach(function (element) {
    element.style.boxSizing = 'border-box';
    var offset = element.offsetHeight - element.clientHeight;
    element.addEventListener('input', function (event) {
      event.target.style.height = 'auto';
      event.target.style.height = event.target.scrollHeight + offset + 'px';
    });
    element.removeAttribute('data-autoresize');
  });
}
Posted by: Guest on April-13-2022

Browse Popular Code Answers by Language