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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:01:37+00:00 2026-05-13T10:01:37+00:00

Within a div container (#links) I want to be able to hover over the

  • 0

Within a div container (#links) I want to be able to hover over the links then perform an action (to be implimented later). When I exit the div box (#links) I want a different action to take place.

The problem: Hovering into the div container (#links) works. When I goto click on a link it logs the attribute as asked. However when I leave the div container (#links) and go back in, click on a link instead of a single log event being displayed. Next time I do that, it shows it 3 times, 4 times etc…

The html:

<div id="links">
    <ul>
        <li><a href="javascript:void(0)" name="link_1" >link 1</a></li>
        <li><a href="javascript:void(0)" name="link_2" >link 2</a></li>
        <li><a href="javascript:void(0)" name="link_3" >link 3</a></li>
        <li><a href="javascript:void(0)" name="link_4" >link 4</a></li>
        <li><a href="javascript:void(0)" name="link_5" >link 5</a></li>
    </ul>
    </div>

The JS:

var jQ = jQuery.noConflict();
        jQ(document).ready(function()
        {

                jQ("#links").hover(
                    function() {
                        console.log("links over")
                        jQ("a").click(function() {
                            console.log(this)
                        })
                    },
                    function() {
                        console.log("links out")
                    }
                );
        });

Console:
note:: all the “a” attributes are a result of a SINGLE click.

links over

a name=”link_5″ href=”javascript:void(0)”

links out

links over

a name=”link_5″ href=”javascript:void(0)”

a name=”link_5″ href=”javascript:void(0)”

links out

  • 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-13T10:01:37+00:00Added an answer on May 13, 2026 at 10:01 am

    Don’t define your $.click() method within $.hover(); Each time you hover, you’re adding yet another event to the click:

    jQ("a").click(function() {
      console.log(this)
    })
    

    That should be extracted from your $.hover() call.

    var jQ = jQuery.noConflict();
    jQ(document).ready(function()
    {
      jQ("a").click(function() {
        console.log(this)
      });
    
      jQ("#links").hover(
        function() {
          console.log("links over");
        },
        function() {
          console.log("links out");
        }
      );
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm trying to vertical align images within a container div. I tried adding
I need to set the text within a DIV element dynamically. What is the
How do I get the div from within this (the last) list item? Currently
I use div tags to define areas within my web pages. I set all
How can I horizontally center a <div> within another <div> using CSS? <div id="outer">
Within c#, I need to be able to Connect to a remote system, specifying
I have two divs inside a div, I want them both adjacent to each
If you have two divs contained within a div: <div style=border:1px;> <div style=float:left;background-color:red;width:20px;height:20px;> <div
Within an application, I've got Secret Keys uses to calculate a hash for an
Within Ruby on Rails applications database.yml is a plain text file that stores database

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.