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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:29:30+00:00 2026-05-29T22:29:30+00:00

i want to make equal height function in javascript , i used getElementsByName method

  • 0

i want to make equal height function in javascript , i used getElementsByName method to get it done, but its seem to be not working , i want to pick maximum height of the div and apply it other divs which have the same id

equl height function

<script type="text/javascript">

function equalHeight () {

var get= document.getElementsByName('jj');

for (i=0;i<get.length;i++){

    var m = get[i].offsetHeight;
    alert (m)   

    var n= Math.max(m);




    document.getElementsByName('jj').style.height= n +"px";

}






    }

window.onload = equalHeight;




</script>

</head>

<body>
<div style="margin:0 auto; width:500px;">
<div style="border:solid #F00 1px; float:left; width:150px" name="jj">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>

<div name="jj" style="border:solid #F00 1px; float:right; width:150px">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.

The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.</div>



</div>
</body>
</html>
  • 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-29T22:29:31+00:00Added an answer on May 29, 2026 at 10:29 pm

    I think the “equalHeight” function should be:

    var get = document.getElementsByTagName('div'), 
        maxHeight = 0, i;
    
    for (i = 0; i < get.length; i++) {
    
        var m = get[i].offsetHeight;
        if (m > maxHeight) {
            maxHeight = m;
        }
    }
    
    for (i = 0; i < get.length; i++) {
    
        get[i].style.height = maxHeight + "px";
    }
    

    div not support the name attribute, you can put all the div in a parent div and give the parent div an “id” just like this:

    <div id="parent_div">
       <div></div>
       <div></div>
    </div>
    

    then get the divs:

    var get = document.getElementById("parent_div").getElementsByTagName("div");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make markersize equal to a single unit in height. It seems
I am traversing a HTML document using javascript DOM. I want make a list
I want to make an entity that has an autogenerated primary key, but also
I need a sidebar and a content area. I want to have equal height
I want to make a WPF TextBox have a DarkBlue border and thickness equal
I have a table (a calendar, notably). I want to make the calendar not
I have a site . I want to make 3 vertical divs with equal
I'm trying to make a LinearLayout that has three rows, each of equal height.
I need some help with my design. I want to display three equal-height boxes
I want to make my textbox height increases as the user inputs more text

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.