I’m sure there is a more efficient way to do this, but it suited my needs.
<script> $(function() { $('textarea').keyup(function(){ $(this).each(function(index, element) { $(element).height(element.scrollHeight); }); }).keyup(); //trigger event to initialize pre-filled textareas }); </script>
Enjoy 🙂
Seems that did not age well 😛 Try this instead…
Note: Added 2 to scrollHeight to eliminate scrollbar resulting from styles applied to my specific textarea controls. You may not need that adjustment.