control jquery autosize textarea height

362 views Asked by At

I am using the plugin jquery autosize on my site and have found it to work the best among the options available. I had previously had it used in a sidebar, but have redesigned it to now be at the top of the page. I'd like it to appear with the height of a normal text field, but allow it to expand beyond that upon a newline.

The problem I'm running into is autosize makes the textarea bigger than that, about 1.5 times the height of what it should be. I've tinkered with CSS line-heights and font sizes and have wrangled some control over it, but it's still looking weird. Autosize sets the textarea height via a style attribute, and any attempts to change this have resulted in broken functionality.

So, I'm stumped what to do. It seems no matter what, autosize won't let the textarea be just one line worth; always adding extra space below. I appreciate there's probably good reason for this functionality, but have been unable to figure out how to better manage it.

1

There are 1 answers

0
AudioBubble On

dug into the git hub issues, discovered this: https://github.com/jackmoore/autosize/issues/168

The workaround is $('.example').autosize({append:''});

Hopefully this wont be necessary in future versions