Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

JQuery Facebook type expanding text boxes

Posted on 2009-02-23
6
Medium Priority
?
1,831 Views
Last Modified: 2012-05-06
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?
0
Comment
Question by:craig32768
  • 2
  • 2
  • 2
6 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 23710461
You mean

<textarea rows="1"
  onKeyUp="var x=this.value.split('\n');if (x.length>1) { this.rows=x.length }"></textarea>
0
 

Author Comment

by:craig32768
ID: 23710530
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
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 23711055

<textarea rows="1"
  onKeyUp="var x=this.value; if (x.length>200) { this.rows=parseInt(x.length/200) }"></textarea>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 23712313
0
 
LVL 36

Accepted Solution

by:
Loganathan Natarajan earned 2000 total points
ID: 23712318
0
 

Author Closing Comment

by:craig32768
ID: 31550048
Perfect - just what we needed - thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month21 days, 3 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question