use $textarea.innerText = '' won't trigger autosize
ervinewell opened this issue · 1 comments
ervinewell commented
to reproduce: https://jsfiddle.net/ervinewell/ek9mhdq5/1/
jackmoore commented
Hi @ervinewell, Sorry, I'm afraid there is nothing I can do about that. Setting the value or innerText doesn't generate any sort of event that can be subscribed to, so Autosize is unaware that this has happened. However, you can manually tell Autosize to recalculate the size. Here's an example:
// Setup
var ta = document.querySelector('textarea');
autosize(ta);
// Manual value change + update
ta.innerText = "Some new value";
autosize.update(ta);