/autoResizeTextArea

Your TextArea will atomatically resize to fit the user input.

Primary LanguageJavaScriptMIT LicenseMIT

autoResizeTextArea

const  module =  autoResizeTextArea({ele, minHeight, maxHeight)  


ele   The textarea element.
minHeight   The height won't get smaller than this.
maxHeight   The height won't get bigger than this.


module.onKeyDown
An eventMethod. You can assign a function to this method and this function will be executed when the user types a letter.


module.onTypedNewLine
If the page is scrollable and the user is typing a new line out of the viewport the browser by default scrolls down so the line which the user is in becomes visible. You might want to scroll a little more to show some related button or to center correctly the bottom of the element. When this happens this module will call it's onTypedNewLine method and you can assign a function to it and make the adjustments that you need.


module.reset()
It resets the height of the element to the minHeight. You can use it if you have emptied the textAreaElement.value and want that the height is restored to the min.


module.forceTest()
Retest the element height.