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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:26:13+00:00 2026-05-26T07:26:13+00:00

I got an sidebar which need to adjust to the document size. This works

  • 0

I got an sidebar which need to adjust to the document size. This works perfectly, its this code:

<script type="text/javascript">
      $(document).ready(function(){
        $("#sidebar").height( $(document).height() ); 

    });
    </script>

But now i got an form in my website which changes with javascript in size when you put in options. So with other words the whole document gets longer when you put in multiple options. But this script doesn’t adjust to that so the sidebar just gets cut off when you put in more options.

So with other words is there an possibility to make this script adjust automatically or let the following script rerun the function when it returns:

<script>
        treated = new Object(); 
        inputNumber = 1;

        function addOne() {

            //Create an input type dynamically.
            var divElement = document.createElement("div");

            var element = document.createElement("input");
            inputNumber++;
            element.setAttribute("name", "input" +inputNumber);
            element.setAttribute("onkeyup", "if (this.value.length > 1 && treated[this.name] != 1){ addOne(); treated[this.name] = '1'; }");
            element.setAttribute("id", "productoptiesadd");

            var price = document.createElement("input");
            price.setAttribute("name", "price" +inputNumber);
            price.setAttribute("id", "productoptiesaddprice");

            var foo = document.getElementById("japroductopties");

            var htag = document.createElement("h7");
            htag.innerHTML = "Optie " + inputNumber + ":";

            var htags = document.createElement("h7");
            htags.innerHTML = " € ";

            divElement.appendChild(htag);
            divElement.appendChild(element);
            divElement.appendChild(htags);
            divElement.appendChild(price);
            foo.appendChild(divElement);
            }
    </script>

Hope some1 can help :).

  • 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-05-26T07:26:14+00:00Added an answer on May 26, 2026 at 7:26 am

    Why not setting #sidebar height property to 100% in your stylesheet ? Is Javascript really necesary ?

    Otherwise, just write a function SidebarAutoAdjust() with your first code fragment :

    $("#sidebar").height( $(document).height() ); 
    

    Then all you have to do is calling this function at the end of your addOne() function.

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

Sidebar

Related Questions

I've got some code which outputs a news archive sidebar. It all works very
Got some code that is not mine and its producing this warning atm: iehtmlwin.cpp(264)
In my application got one sidebar, which is holding this two component : <Grid
Got some code here that isn't working: $(#sidebar ul li:last).each(function(){ $(this).addClass(last); }); Basically I
Got a requirement to rebuild mssql full-text index. Problem is - I need to
I've got a little sidebar that displaying in the code before the main page
I've got this if ($(#sidebar .box_cuerpo).height() == 0) { //blaaa } But sometimes on
OK so I've got a sidebar built using an NSOutlineView. I currently have two
I suddenly got this long horizontal scrollbar on my Wordpress blog that uses the
I got somethinglike this: <body> <div id=wrapper> <div id=header> <ul> <li>something</li> <li>something</li> </ul> </div>

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.