So I am working on some text area and I dont want scroll bars. I have figured out how to make the the textarea grow as a user inputs new information with the following:
$('.step-change__text').on 'keyup keydown', ->
resize(this);
return
resize = (element) ->
element.style.height = element.scrollHeight + 'px'
return
What Im having trouble finding (cause the searches all lead to the answer above) is users can edit records that are pre-filled with text and I want the text area to be expanded with the text that is already saved.
EDIT: I tried to just do it on page load with this code:
$('.step-change__text').each ->
resize(this)
return
But that didnt do it