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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:54:07+00:00 2026-05-14T04:54:07+00:00

I have no idea how to do this. My markup: <table> <tr> <td id=colLeft>

  • 0

I have no idea how to do this.

My markup:

<table>
    <tr>
        <td id="colLeft">
            Lorem ipsum dolor<br/>
            Lorem ipsum dolor<br/>
            Lorem ipsum dolor<br/>
            Lorem ipsum dolor<br/>
            Lorem ipsum dolor<br/>
            Lorem ipsum dolor.
        </td>
        <td id="colRight">
            <div>1</div>
            <div>2</div>
        </td>
    </tr>
</table>

$(document).ready(function() {
    $('#colRight > div').each(function() { // I try to: select all divs in #colRight
        $(this).height(function(){ // I try to: sets the height of each div to:
            $('#colLeft').height() / $('#colRight > div').length(); // the height of #colLeft divided by the number of divs in colRight.  
        });
    });     
});

What I am trying to do is to change the height of each div to the height of #colLeft divided by the number of divs in #colRight.

However, it doesnt work.

I’ve never understood how to chain functions, and never found anyone to teach me.

So I would like to ask two favours of you.

  1. Why doesnt my above jQuery code.
  2. Does anyone know of a tutorial that explains it more detailed than in the tutorials on the jQuery website?

Thank you for your time.

Kind regards,
Marius

  • 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-14T04:54:07+00:00Added an answer on May 14, 2026 at 4:54 am

    As for the chaining, I would hazard you this: Don’t assume you can always blindly chain. Most of the core jQuery and the jQuery UI stuff will chain with no problem, but some third party modules will not return jQuery objects (which is what the jQuery libs return).

    The basics is like this:

    $( some selector ) is a function call that has a return value of jQueryObject[] like so:

    /* in "pretend land" because this isn't accurate */
    public jQueryObject[] $( some selector ) {
      /* do some magic here with some selector */
      return jQueryObject[];
    }
    

    and because you’re returning a jQueryObject[] then you can substitute it somewhere else. But the magic of chaining says “whatever I am attached to by a period on my left I use as input”. So, if we had:

    int a = 20;
    

    and a function like so:

    public int Doubler(int someInt) {
      return ( someInt * 2 );
    }
    

    then we could chain like thus:

    a.Doubler();
    

    and get 40. But if we were to:

    a.Doubler().Doubler();
    

    then we would have chained twice and our result would be 80;

    But sometimes you’ll see them where they also accept options, which I’m not going to go into. You wanted the basics on how chaining works, so I’ll assume the more advanced stuff you can lookup later. Such as reading the non-min source.

    Now, my earlier caveat was that sometimes libraries for jQuery will return an object to themselves and the object inside the library is not guaranteed to be a jQueryObject[] (to use my own nomenclature again). So that’s outside the scope of the chaining. All libraries will tell you what an object returns, whether it’s an int, string, object, jQuery or whatever.

    So for instance, at the jQuery .height() page, in the blue bar down the page you see: .height() Returns: Integer but further down the page: .height( value ) Returns: jQuery
    and on the .each() page, in the blue bar we see: .each( function(index, Element) ) Returns: jQuery

    So you can see how the API documentation writers tell you what is being returned from each function. That’s how you can know what the next object will take in upon chaining. That’s why sometimes you can’t chain certain things together.

    Ok, that’s a LOT of information in one blow, but you wanted the quick and dirty and if that doesn’t bring you up to speed I don’t know what will.

    tl;dr: sorry for the wall of text, but it’s a contiguous chunk of answer. Ya wanna know, go back and read it.

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

Sidebar

Related Questions

I have this idea for a free backup application. The largest problem I need
I have no idea why this is happening. I have some very straightforward code,
I have an idea for how to solve this problem, but I wanted to
Does anyone have any idea what is wrong with this create statement for mysql?
I have no idea. This causes seemingly random time-outs. These in turn break the
Does anyone have an idea how can I fix this vulnerability in Apache 2.2.4
This probably sounds really stupid but I have noo idea how to implement jquery's
This may be a doozy, but does anyone have an idea how to: Pass
What is the purpose of annotations in Java? I have this fuzzy idea of
Okay, this is just a crazy idea I have. Stack Overflow looks very structured

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.