My guess would be to count the character number on keypress and
increase height accordingly.

<textarea ... cols="40"></textarea>

var $text = $('textarea'),
 oHeight = $text.height(),
 cols = +$text.attr('cols'),
 lineHeight = parseInt($text.css('line-height'));

$text.bind('keypress', function(){
  ln = $text.val().length, m = ln%cols;
  if (ln && !m) $text.animate({height: oHeight + (ln/cols)
*lineHeight});
});

The column number/character count doesn't seem reliable, but it kinda
works:

http://jsbin.com/odipi

cheers,
- ricardo

On Feb 11, 9:55 pm, "Rick Faircloth" <r...@whitestonemedia.com> wrote:
> I'd like to figure out a way to make a textarea
> that expands with text input when necessary and shrinks,
> also, if possible...and without scrollbars.
>
> I've looked around, but haven't found a solution that
> does everything.
>
> Anyone know if that's possible with jQuery?  Or how to do it?
>
> Rick

Reply via email to