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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:10:50+00:00 2026-05-26T17:10:50+00:00

I have a div with elements (h3, img, p) inside. I want to use

  • 0

I have a div with elements (h3, img, p) inside. I want to use jQuery to detect when a user hovers over this div to then toggle a class of an element in this div.

I’m using the code below:

$('.entry').bind({
    mouseover: function() {
    $('.readMore').toggleClass('inverted');
    },
    mouseleave: function() {
    $('.readMore').toggleClass('inverted');
    }
});

This works as expected when hovering over just the div. If you hover over an element inside the div (eg. .entry h2) it toggles the class off as though it has left the parent div (.entry) but it’s actually inside it. The elements are not floating inside div.entry which I had thought might throw it off. I tried $(".entry *") and $(".entry, .entry *") but both of these have similar issues.

Any thoughts?

  • 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-26T17:10:51+00:00Added an answer on May 26, 2026 at 5:10 pm

    Try using mouseenter and mouseleave instead.

    Here’s the relevant piece of documentation about mouseenter vs mouseover:

    The mouseenter event differs from mouseover in the way it handles
    event bubbling. If mouseover were used in this example, then when the
    mouse pointer moved over the Inner element, the handler would be
    triggered. This is usually undesirable behavior. The mouseenter event,
    on the other hand, only triggers its handler when the mouse enters the
    element it is bound to, not a descendant.

    Here’s an example that might help; note what events are fired off when you move your pointer in and out of elements.

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

Sidebar

Related Questions

I have a img element. When the user hovers over it, I want to
I have a webpage with multiple DIV elements. If i use the jquery function
I have two HTML elements inside a div. I want to display them in
I have a <div> with two floated elements inside of it. I'm using jQuery
I have a container div, and numerous elements inside of it (i.e. spans, img,
If I have a collection of div elements, I can use CSS to have
I have a set of selected elements in jQuery: <div class=element></div> <div class=element></div> <div
I have an element inside a div that is draggable jquery ui. And I
I have this html configuration: <div id=Header> <div id=Stamp> <img alt=Header Stamp src=images/About-Us.png />
If I have this css div.myContainer img.noCampaign { display:none; } and this html/javascript <div

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.