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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:59:10+00:00 2026-06-16T16:59:10+00:00

I have 10 html divs with same class name dp-check which i am using

  • 0

I have 10 html divs with same class name “dp-check” which i am using as a component
and used at lots of time in the same page. Now my problem is initially all divs are hidden when i clicks one of them then its “display” is set to “inline”(only of that instance) and all others are hidden, I want to close when any other div with same class name is shown or somewhere else on page is clicked.

  • 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-16T16:59:11+00:00Added an answer on June 16, 2026 at 4:59 pm

    Try this:

    function clickHandler(e){
        e = e || window.event;
        var elements = document.getElementsByClassName('dp-check');
        for(var i = 0; i < elements.length; i++){
            elements[i].style.display = 'none'; // Hide all elements.
        }
        e.target.style.display = 'inline'; // Show the clicked element.
    }
    

    You’ll have to assign the clickHandler to the click events on the elements.

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

Sidebar

Related Questions

I have two toggle divs that have same class name. When i click one
In a page with n divs of the same class, I want to have
i have multiple divs with the same class on my page. I want to
I have ASP.Net code generating my button's HTML for me using divs to get
I have a page with several .desc divs. I want to add some html
i have html elements <ul> <li> <dl class=details clear> <dt>TIME&nbsp;:&nbsp;&nbsp;&nbsp;</dt> <dd>09:00:00-10:00:00</dd> <dt>Availible&nbsp;Days&nbsp;:&nbsp;&nbsp;</dt> <dd>monday,tuesday,wednesday</dd> <dt></dt>
I have html that has 2 divs with the same id's in jquery i
I have a group of hidden divs all with the same class but with
I have several divs on a page. Each div has a heading which I
I'm trying to toggle hide/show on all divs with the same class. I have

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.