I have a textarea with a fixed width, and I want to make it auto-resize vertically when the text wraps or the user enters a new line.
I know how I can do it in javascript, but I cannot figure out how to get it to work in hyperscript.
Here’s how I started. I understand that hardcoding 17 as the line height (it’s actually 2.5rem) and 10 as the character width is wrong, but I’m just trying to get this naive thing working first.
on keyup
log Math.ceil((my value.length * 10) / my clientWidth) * 17
set my.style.height to Math.ceil((my value.length * 10) / my clientWidth) * 17
It logs what I expect, but it won’t set the height on the textarea. I’ve tried using *height
as well instead of my.style.height
with no luck. What gives?