


var ta = document. autosize(document. This event is fired every time autosize adjusts the textarea height. The autosize function accepts a single textarea element, or an array or array-like object (such as a NodeList or jQuery collection) of textarea elements. stroy( document.querySelectorAll( 'textarea')) Removes Autosize and reverts any changes it made to the textarea element. querySelector ( textarea ) ta.style. Include the autoResize.js plugin after loading the latest jQuery library. Works perfectly with most CSS frameworks like Bootstrap, Bulma, TailwindCSS, etc. Choosing whether to do height or width depends on your image and container dimensions: If your image and container are both 'portrait shaped' or both 'landscape shaped' (taller than they are wide, or wider than they are tall, respectively), then it doesn't matter which of height or width are '100'. Init var ta = document.querySelector( 'textarea') Use the autosize.update method (or trigger the autosize:update event) after the element has been revealed. autoResize is the simplest jQuery textarea resize plugin that automatically increases and decreases the height of your textarea element to fit its content. There is no efficient way for Autosize to monitor for when another script has changed the textarea value or for changes in layout that impact the textarea element. Autosize will automatically adjust the textarea height on keyboard and window resize events. Triggers the height adjustment for an assigned textarea element. from a NodeListĪutosize( document.querySelectorAll( 'textarea')) Īutosize( document.querySelector( 'textarea')) The autosize function accepts a single textarea element, or an array or array-like object (such as a NodeList or jQuery collection) of textarea elements. Released under the MIT License, source on Github ( changelog)ĭownload Install via NPM npm install autosize
