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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:36:51+00:00 2026-06-11T23:36:51+00:00

I have a list of <divs> with the same class. Within each <li> are

  • 0

I have a list of <divs> with the same class. Within each <li> are two <divs>. I want to hide one <div> when the user hovers over the other <div>.

The issue I am having is that when I use the following code, every <div> with the class “.div_2” is hidden when I hover over ANY <div> with the class “.div_1”.

I want it so only the <div> with the class “.div_2” is hidden when the user hovers over the with class “.div_1” in that specific <li>

I cannot change the markup or the classes, and was wondering how I can achieve this. Could I combine $(this) with “.div_2”?

<li>
<div class="div_1"></div>
<div class="div_2"></div>
</li>    
<li>
<div class="div_1"></div>
<div class="div_2"></div>
</li> 
... 

$(document).ready(function(){
    // MEDIA GALLERY HOVER //

        $(".div_1").hover(
          function () { $(".div_2").hide(); },
          function () { $(".div_2").show(); }
        );

})
  • 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-11T23:36:52+00:00Added an answer on June 11, 2026 at 11:36 pm

    You can use next method, which selects the next sibling of the element or siblings method.

    $(".div_1").hover(
        function () { $(this).next().hide(); },
        function () { $(this).next().show(); }
    );
    
    • next()
    • siblings()
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of Divs within another div and I want to only
I have list of divs all with the same class, I want to apply
Say I have a list of divs identified by class .e.g '.myclass' Inside each
I want to keep a list of all divs with same class name i.e
I have the 2 divs that I want styled the same. One is called
I have a list of divs (simplified example) <div class=title>text</div> <div class=description>text</div> <div class=title>text</div>
I have a list of divs with onclick actions associated with them. Inside each
I have a series of divs like this: <div id=available-posts> <div class=post id=unique_id> <a
I have three unordered list each surrounded by a container div (An example is
I have a list of div on a parent function, each does a onclick

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.