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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:51:30+00:00 2026-06-13T11:51:30+00:00

I have an old project that does contain HTML with duplicate IDs. Switching selectors

  • 0

I have an old project that does contain HTML with duplicate IDs. Switching selectors from ids to classes needs a lot of work, Can I do it with the JQuery, specially that I know how many divs I’ll hide.

<div id="d"></div>
<div id="d"></div>
<div id="d"></div>

I want to hide them all using a single action :

$('#d').hide(); 

but it hides the first div only.

  • 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-06-13T11:51:31+00:00Added an answer on June 13, 2026 at 11:51 am

    You hid by id, which won’t work as you have non-unique ids. Add a data-* attribute to them or a class as a flag.

    <div data-someattributename="flag" id="d">
    
    $('div[data-someattributename]').hide();
    

    Due to your edit:

    $.each($('div'), function() {
        If ($(this).attr('id')=="d") {
            $(this).hide();
        }
    });
    

    I’m not sure if the ids are wiped after the first one since they are duplicated, but if they’re not, this should work.

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

Sidebar

Related Questions

I have a very old project that includes the source from another project directly,
I have an old project at our company that uses shell scripting a lot.
I have a few usercontrols from an old Windows CE project that I'd like
I have an old project that is mixed C and C++. It makes extensive
I have an old EJB (2.1) project that uses xdoclet (1.2.3) to generate the
I have an old project that I'm resurrecting as it were, and it makes
I have an old C project that compiles just fine in Unix. I want
I have inherited a project that logs data from a single board computer to
I have an old project from the 1990's I desperately need to compile. The
We have an old project that we maintain that uses brace indenting. Rather than

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.