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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:57:23+00:00 2026-05-25T15:57:23+00:00

I have a 6 divs in a html doc that have the following characteristics:

  • 0

I have a 6 divs in a html doc that have the following characteristics:

<div id="m1_1"  title="Sept. 05, 2011" class="eheader">MR 1 &#151;</div>
<div id="m1_8"  title="Sept. 05, 2011" class="eheader">MR 8 &#151;</div>
<div id="m1_12" title="Sept. 05, 2011" class="eheader">MR 12 &#151;</div>
<div id="m1_16" title="Sept. 12, 2011" class="eheader">MR 16 &#151;</div>
<div id="m1_17" title="Sept. 12, 2011" class="eheader">MR 17 &#151;</div>
<div id="m1_19" title="Sept. 15, 2011" class="eheader">MR 19 &#151;</div>       

Their id’s are something like m1_1, m1_2, m1_3, m1_4, m1_5 and m1_6. The numerical digits after the underscore are generated dynamically so I can’t directly target say… “m1_8”.

They all share the same class which is unique to the group. In my css I’m setting the display property for divs of this class to “hidden” or “none”.

They all have a title element which is set to the date they were created.

What I need is a function that will loop through the divs by class name and target all of the unique titles and the first member of any duplicate titles. In the above example, m1_19 would be targeted because its title (create date) is unique to the set. divs m1_1 and m1_16 would also be targeted because they are the first members of duplicates.

My function outline looks like this… of course there’s a huge chunk of logic missing and I’m not even sure I set up the loop correctly. Can this be done or am I on the wrong track completely?

function checkHeaders(){
    var hdrSet = document.getElementsByClassName("eheader");

    for (var i=0; i<hdrSet.length; i++){
        if (hdrSet[i].title {
            hdrSet[i].style.display = "block";
        }
    }

}
  • 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-25T15:57:24+00:00Added an answer on May 25, 2026 at 3:57 pm
    function checkHeaders(){
        var hdrSet = document.getElementsByClassName("eheader");
        var titles = {};
    
        for (var i=0; i<hdrSet.length; i++){
            if ( !titles[ hdrSet[i].title ] )  {
                titles[ hdrSet[i].title ] = true;
                hdrSet[i].style.display = "block";
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following html divs : ... <body> <div id=barChart_div style=width: 600px; height:
I have some HTML that looks like this: <div class=MyClass></div> <div class=MyClass></div> <div class=MyClass></div>
I have the following HTML snippet: <body> <div class=main> <div class=topBar> <p>testing</p> </div> <div
I have a html like this: The idea is that divs are floated left
I have 3 divs and I cannot change the html dom: <div id=a/> <div
I have 2 DIVs on an HTML page: <div id=divDebug /> <div id=divResult />
So I have divs like this on my page: <div class=drag></div> And this jquery
On my HTML page I have forty divs but I only want one div.
I have 2 divs in an HTML page -that need refreshing when an event
How do I get all divs that have a class = 'round' and a

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.