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 7778487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:24:36+00:00 2026-06-01T18:24:36+00:00

I am making a web app for the user to create a simple orgchart.

  • 0

I am making a web app for the user to create a simple orgchart. I don’t even have the lines connecting the nodes yet, but I am using text areas. I found a very useful autosize() plugin that is great for adding an extra row when the width is taken up. Is there a way to make it so that if the user only uses one line, the autoresize will shrink the width to wrap around the text?

I was trying to figure out how to do the jsfiddle but I dont know how to add more than one javascript (for the plug-in) so Ill just put my jquery code at the bottom of the plug-in and put the plug-in at in the javascript area in the jsfiddle

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Pathway Builder 2.0</title>
    <link rel="stylesheet" href="PathwayBuilder2.css" type="text/css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
    <script src="PathwayBuilder2.js" type="text/javascript"></script>
    <script src="plug-ins/autosize.js" type="text/javascript"></script>
</head>




<body>
    <div id="Pathway">
        <div class="whole">
            <div class="text_display">
                <textarea class="text_field_not_selected"></textarea><br />
                <input type="button" class="add_child" value="+" />
            </div>
        </div>
    </div>
</body>
</html>

javascript/jquery

$(document).ready(function() {
    $('textarea').autosize();
});

$(document).ready(function() {
    $('.add_child').live({
        click: function() {
            var new_child = '<div class="whole"><div class="text display"><textarea class="text_field_not_selected"></textarea><br /><input type="button" class="add_child not_visable" value="+" /></div></div>';
            $(this).closest('.whole').append(new_child);
            $('.text_field_not_selected').autosize();
        }
    });
});

$('textarea').live('focusin blur', function() {
    $(this).toggleClass('text_field_not_selected');
});

css

body {
    margin: 0px;
    padding: 0px;
    text-align: center;
}
#pathway {
    display: block;
}
.whole {
    text-align: center;
    display: inline-block;
    vertical-align: top;
    margin-left: auto;
    margin-right: auto;
    padding: 10px;
}
textarea {
    min-width: 2em;
    text-align: center;
}
textarea:focus {
    resize: none;
}
.text_field_not_selected {
    resize: none;
    border-radius: 10px;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    box-shadow: 0px 3px 5px #444;
    -moz-box-shadow: 0px 3px 5px #444;
    -webkit-box-shadow: 0px 3px 5px #444;
}
.add_child {
    margin-bottom: 25px;
}
  • 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. Editorial Team
    Editorial Team
    2026-06-01T18:24:37+00:00Added an answer on June 1, 2026 at 6:24 pm

    here you go working demo : http://jsfiddle.net/YVEhr/30/ (more apt)
    or http://jsfiddle.net/YVEhr/1/

    Please let me know if thats what you want, I am happy to help out. took me a bit to got it (i.e. resizing idea) 🙂

    Edit Okies I got it now (Phew) Please feel free to play around with the css or you can have ‘row=something` to start with, I have shared some links for further help. 🙂

    Demo http://jsfiddle.net/YVEhr/30/

    Resizing the textarea to fit the screen: good link: or you can also look into this man: http://archive.plugins.jquery.com/project/TextFill

    Jquery Code

    //inital resize
    resizeTextArea($('textarea'));
    
    //resize text area
    function resizeTextArea(elem){
       // alert(elem[0].scrollHeight + ' ---- ' + elem[0].clientHeight);
        elem.height(1); 
        elem.scrollTop(0);
        elem.height(elem[0].scrollHeight - elem[0].clientHeight + elem.height());
    }
    
    //'live' event
    $('textarea').live('keyup', function() {
        var elem = $(this);
       // alert('foo');
        //bind scroll
        if(!elem.data('has-scroll'))
        {
            elem.data('has-scroll', true);
            elem.bind('scroll keyup', function(){
                resizeTextArea($(this));
            });
        }
    
        resizeTextArea($(this));
    });
    

    Please let me know if thats what you want.

    Explanation

    Just need to bind new etxtareaclass to .autosize() function and rest you can see it in jsfiddle.

    Dont forget to accept the answer & if you like you can use this solution without using any plugin: jQuery – Building an AutoResizing TextArea that Doesn't Flash on Resize

    Anywho this will work, hope this helps and have a nice one, cheers!

    JQuery Code

    $(document).ready(function() {
    
        $('.add_child').live({
            click: function() {
                var new_child = '<div class="whole"><div class="text display"><textarea class="text_field_not_selected"></textarea><br /><input type="button" class="add_child not_visable" value="+" /></div></div>';
                $(this).closest('.whole').append(new_child);
                $('.text_field_not_selected').autosize();
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some problems with making my web-app adapted for remote user browseres language
I am practicing making a web app which tries to read the user's twitter
I'm making a Django web-app which allows a user to build up a set
I'm making a mobile web app. At the top of the page, I have
I have a web app I'm making to run off a CMS that is
I am making a Music player for my web app. After user upload some
im making an iphone web based app and i have embedded a google maps
I am making a web page which create user and a page from which
I'm making a web app in Django that sends user an image to their
i've been making web app's and working with various server side language like php,

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.