JQuery Facebook type expanding text boxes

Does anyone know how to control a multi-line textbox using JQuery so it behaves the same as the ones in Facebook where it starts at say x lines and expands by x+1 as the user continues typing?
craig32768Asked:
Who is Participating?
 
Loganathan NatarajanLAMP DeveloperCommented:
0
 
Michel PlungjanIT ExpertCommented:
You mean

<textarea rows="1"
  onKeyUp="var x=this.value.split('\n');if (x.length>1) { this.rows=x.length }"></textarea>
0
 
craig32768Author Commented:
Not quite - it doesn't expand as you type, only when you press return / enter. But clever anyway :-)

On the Facebook one it seems to keep track of the number of characters types to control the height...
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Michel PlungjanIT ExpertCommented:

<textarea rows="1"
  onKeyUp="var x=this.value; if (x.length>200) { this.rows=parseInt(x.length/200) }"></textarea>
0
 
Loganathan NatarajanLAMP DeveloperCommented:
0
 
craig32768Author Commented:
Perfect - just what we needed - thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.