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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:29:01+00:00 2026-05-24T09:29:01+00:00

I just learned that an object can have only one ID, so I’m not

  • 0

I just learned that an object can have only one ID, so I’m not sure as to how I should continue with this.

How can I, for example assign a css class to ALL divs that share a certain attribute (cannot be ID as I need that tag for something else) except the DIV that I specify? I could maybe do this by removing this specific ID from the div I don’t want to change and then add the class to all those DIVS with that “id”… However I still don’t know how I can identify these divs when I need to use the ID tag for something else.
Thank you 🙂

The reason why I want this:

I have 5 buttons;
When I click one all 4 other DIVS that contain the other buttons will become disabled except this one DIV with this button. I did not want each button to have a function such as:
Button 1 {
disable1
disable2
disable3
disable 4
} for each…

but rather
Button 1 {
Make itself VARIABLE 2
Disable all VARIABLE 1
}

Hope that clears up everything 🙂


Thanks for your answers everyone, all of them solved what I wanted to know 🙂

  • 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-24T09:29:02+00:00Added an answer on May 24, 2026 at 9:29 am

    Not only can an object (element) have only one id, but also an id can be assigned to only one element. So you cannot give all those divs the same id.

    You can use the class attribute. This is meant for this purpose since elements can have multiple classes and multiple elements are allowed to share the same class or classes.

    <div id="id1" class="specialDiv"> ... </div>
    <div id="id2" class="specialDiv"> ... </div>
    

    Then use the class selector (using . instead of #):

    $('.specialDiv').hide();
    

    Alternatively, you can use a selector that includes all the ids, like this:

    $('#id1, #id2, #id3').addClass('specialDiv');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just learned yesterday from this site that I can: class Seq(object): def __init__(self,
I just finished a computer organization course, in which we learned that all files
I have learned to use the SCOPE_IDENTITY() instead of just @@IDENTITY to get the
I've learned programming from Java, then tried to learn one programming language per year,
I have known PHP basics, functional programming for a long time before. But this
I'm working on a site where users can post notes. I'm considering allowing users
I am sorry ahead of time for how this question may turn out. I
Hello developers and designers, I am very willing to learn WPF in which i
I am working on a project which requires the use of Google Maps and
We tried adding Rampart to our module's POM file and after doing so our

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.