Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 35317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:13:01+00:00 2026-05-10T14:13:01+00:00

I’m currently working on an internal sales application for the company I work for,

  • 0

I’m currently working on an internal sales application for the company I work for, and I’ve got a form that allows the user to change the delivery address.

Now I think it would look much nicer, if the textarea I’m using for the main address details would just take up the area of the text in it, and automatically resize if the text was changed.

Here’s a screenshot of it currently.

ISO Address

Any ideas?


@Chris

A good point, but there are reasons I want it to resize. I want the area it takes up to be the area of the information contained in it. As you can see in the screen shot, if I have a fixed textarea, it takes up a fair wack of vertical space.

I can reduce the font, but I need address to be large and readable. Now I can reduce the size of the text area, but then I have problems with people who have an address line that takes 3 or 4 (one takes 5) lines. Needing to have the user use a scrollbar is a major no-no.

I guess I should be a bit more specific. I’m after vertical resizing, and the width doesn’t matter as much. The only problem that happens with that, is the ISO number (the large ‘1’) gets pushed under the address when the window width is too small (as you can see on the screenshot).

It’s not about having a gimick; it’s about having a text field the user can edit that won’t take up unnecessary space, but will show all the text in it.

Though if someone comes up with another way to approach the problem I’m open to that too.


I’ve modified the code a little because it was acting a little odd. I changed it to activate on keyup, because it wouldn’t take into consideration the character that was just typed.

resizeIt = function() {   var str = $('iso_address').value;   var cols = $('iso_address').cols;   var linecount = 0;    $A(str.split('\n')).each(function(l) {     linecount += 1 + Math.floor(l.length / cols); // Take into account long lines   })    $('iso_address').rows = linecount; }; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T14:13:02+00:00Added an answer on May 10, 2026 at 2:13 pm

    Facebook does it, when you write on people’s walls, but only resizes vertically.

    Horizontal resize strikes me as being a mess, due to word-wrap, long lines, and so on, but vertical resize seems to be pretty safe and nice.

    None of the Facebook-using-newbies I know have ever mentioned anything about it or been confused. I’d use this as anecdotal evidence to say ‘go ahead, implement it’.

    Some JavaScript code to do it, using Prototype (because that’s what I’m familiar with):

    <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'   'http://www.w3.org/TR/html4/loose.dtd'> <html>     <head>         <script src='http://www.google.com/jsapi'></script>         <script language='javascript'>             google.load('prototype', '1.6.0.2');         </script>     </head>      <body>         <textarea id='text-area' rows='1' cols='50'></textarea>          <script type='text/javascript' language='javascript'>             resizeIt = function() {               var str = $('text-area').value;               var cols = $('text-area').cols;                var linecount = 0;               $A(str.split('\n')).each( function(l) {                   linecount += Math.ceil( l.length / cols ); // Take into account long lines               })               $('text-area').rows = linecount + 1;             };              // You could attach to keyUp, etc. if keydown doesn't work             Event.observe('text-area', 'keydown', resizeIt );              resizeIt(); //Initial on load         </script>     </body> </html> 

    PS: Obviously this JavaScript code is very naive and not well tested, and you probably don’t want to use it on textboxes with novels in them, but you get the general idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a small JavaScript validation script that validates inputs based on Regex. I
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.