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

  • Home
  • SEARCH
  • 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 7646067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:06:39+00:00 2026-05-31T10:06:39+00:00

i want to set equal height in div which have class name modelCode so

  • 0

i want to set equal height in div which have class name “modelCode” so i made a small function to do so but when i am running this function it is setting height 0px in elemeny style. Before that i used .height() method which is working perfactly but i want to this with css height method any guess. Thanks in advance

<head>
    <script type="text/javascript">
    function equalHeight(group) {
        var tallest = 0;
        group.each(function () {
            var thisHeight = $(this).css('height');
                if (thisHeight > tallest) {
                    tallest = thisHeight;
                }
         });
         group.css('height',tallest);
    }

    function setequalheight() {
        equalHeight($(".modelCode"));
    }

    $(document).ready(function () { setequalheight() });
    </script>
<style>
    .modelCode { width:200px; float:left; border:solid 1px #F00}
</style>
</head>
<body>
    <div class="modelCode">i am new text </div>
    <div class="modelCode">i am new text <br />i am new text <br />i am new text <br />i am new text <br /></div>
  • 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-31T10:06:40+00:00Added an answer on May 31, 2026 at 10:06 am

    it will work now

    function equalHeight(group) {
    var tallest = 0;
    group.each(function () {
        var thisHeight = $(this).css('height');
        thisHeight = parseInt(thisHeight.substr(0 , (thisHeight.length - 2)));
        //alert(thisHeight)
        if (thisHeight > tallest) {
            tallest = thisHeight;
        }
    
    
    });
    
    group.css('height',tallest);
    }
    

    the problem is that .css(‘height’) returns a string value, so you have to parse it to integer to compare which is bigger value

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

Sidebar

Related Questions

I have one container div which contain 2 dynamic height (height haven't been set)
E.g: .container{ width:200px; height:16px;overflow:hidden;font-size:13px; } <div class=container> I want to know this sentence's width
So I have a double set to equal 1234, I want to move a
I want set Listbox background to transparent but not working Is there any idea?
I want to set a background image for a div, in a way that
I want to set a breakpoint on the __DoPostBack method, but it's a pain
I want to set some attributes just before the object is serialized, but as
I want to make a WPF TextBox have a DarkBlue border and thickness equal
Sounds simple enough, but its not working. In this example, I want to set
My table has a column order that I want initially set to equal the

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.