
JavaScript cannot accurately calculate the width of an element that has been. On other textareas that are not dynamically it's working. The autosize function accepts a single textarea element, or an array or. Okay, at least I found the problem: The textareas are generated by AJAX, so they are dynamically generated. Resolved an issue that was causing slowing down initialization for large blocks of text in Chrome. But still the same error.Īny more suggestions on what I could do to make it work? I even tried to remove the yarn package and download the files. I was recently working on a side project and found myself.

When you load new content via an ajax call, you can. Approaches to Using autosize.js to Automatically Resize a textarea on User Input. Then I tried setting a global scope for the variable: tosize = autosize įor initialization I followed the readme: autosize($('textarea')) To add the auto resize, just call the function addAutoResize() once your textareas are exposed in DOM.

Then I imported it in different ways to try if it works somehow (as all other plugins are working). Then I required it in my application.js, I tried different solutions: require("autosize") I added the plugin via yarn with yarn add autosize

You can use this to adjust your text relative to the height you want. See the project page for documentation, caveats, and a demonstration. autosize () method on any textarea element. I'm trying to get autosize.js to work in my Rails 6 application but it doesn't matter what I try, it's not working.Įvery time I try to use it on a textarea I'm getting this error: Here's a way to find the height of the text that you are using. Small jQuery plugin to allow dynamic resizing of textarea height, so that it grows as based on visitor input.
