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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:19:06+00:00 2026-06-03T20:19:06+00:00

<div id=side> <h2 class=1>1</h2> <h2 class=2>2</h2> <ul> <li><a class=3href=>3</a></li> <li><a class=4 href=>4</a></li> </ul> </div>

  • 0
<div id="side">
    <h2 class="1">1</h2>
    <h2 class="2">2</h2>
    <ul>
        <li><a class="3"href="">3</a></li>
        <li><a class="4" href="">4</a></li>
    </ul>
</div>

What would the code be so when I hover over an <a> it will display the <h2>? So .3 would display .1?

This is what I’ve tried so far:

<script type="text/javascript"> 
    $(document).ready(function() { 
        $("#side a").hover( 
            function() { 
                $(this).children('.h2').show(); 
            }, 
            function() { 
                $(this).children('h2').hide(); 
            } 
        ); 
    }); 
</script>
  • 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-03T20:19:08+00:00Added an answer on June 3, 2026 at 8:19 pm

    This is an example for your test case, you should improve it for your live app.

    JSFiddle link: click here

    $(document).ready(function(){
        $("#side h2").hide();
        $("#side ul li a").mouseover(function() {
            if($(this).hasClass("3")) {
                $("#side h2.1").show();
            } else if($(this).hasClass("4")) {
                $("#side h2.2").show();
            } 
        }).mouseout(function() {
            if($(this).hasClass("3")) {
                $("#side h2.1").hide();
            } else if($(this).hasClass("4")) {
                $("#side h2.2").hide();
            }
        });
    })
    

    JSFiddle link: click here

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

Sidebar

Related Questions

Here is HTML code: <div class=row> <span class=item><a href=#>A</a></span> <span class=item><a href=#>B</a></span> <span class=item><a
Can any one help me with this code: ASP: <script type=text/javascript> function confirm_delete(div.ID)// problem
So, I'm trying to create a div class that will display in a row
In some page, my side menu is created dynamically like this. <div id=tree class=treeview>
My goal is to display two <div> s side-by-side with the content from both
I have this JSON layout: [ { tag: div, attr: [ [id, sortSideStyleIlluminated], [class,
I want to display a toolbar if the mouse is over a div or
I have a list of DIVs, like this : <div id=list> <div class=classA classB
Trying to replace this jquery code with some php server side magic: $(document).ready(function() {
all i need is some client side code jQuery or JS that will alter

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.