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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:51:30+00:00 2026-06-13T01:51:30+00:00

$(.hovertip).parent().on(‘hover’, function() { alert(‘yay’); }); I’d like to get something like the above working

  • 0
$(".hovertip").parent().on('hover', function() {
  alert('yay');
});

I’d like to get something like the above working like .live() so that it catches dynamic changes to the DOM.

I tried something like this…

$(".hovertip").on('hover', $(this).parent(), function() {
  alert('yay');
});

But it doesn’t seem to work…

Note – this is a continuation of jQuery Live traversal parent() selector which addresessed .on() with .parent() but the dynamic DOM change issue isn’t resolved.


Update:

Thanks for the suggestions…

I’m having trouble still getting this code to work live when performing actions on the function and have them work like .live when the DOM changes. For example… (this doesn’t work when the DOM changes)…

$(".hovertip").parent().on('mouseenter', function() {
    var hovertipParentHeight = $(this).outerHeight();
    $(this).find(".hovertip").css("top", (hovertipParentHeight-hovertipHeight)/2 + "px");

I think the issue is if I were to implement a suggested solution, I’d still need $(this).parent() before the main selector to be a callback and it doesn’t seem .parent() supports callbacks: http://api.jquery.com/parent/

For example:

$('.hovertip').on('hover', function(){
  $(this).parent(function() {
  var hovertipParentHeight = $(this).outerHeight();
  $(this).find(".hovertip").css("top", (hovertipParentHeight-hovertipHeight)/2 + "px");
 ...

});

Doesn’t work.

  • 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-13T01:51:31+00:00Added an answer on June 13, 2026 at 1:51 am

    Your mistake is that this in the selector (2nd) parameter doesn’t refer to .hovertip.

    If you want to catch the event in each parent of a .hovertip element you could do it like this:

    $('.hovertip').parent().on('hover', '.hovertip', function(){
      alert('yay');
    });
    

    If the parents all have the same class you should use @Matt Stone’s solution.

    Update: I just saw your answer on the other post:

    $(“.hovertip”).parent().on(‘hover’, function() { alert(‘yay’); }); is working, unfortunately once the page refreshes through AJAX it stops working.

    That’s because it stops working when the element with the event handler attached (in your case the parents of .hovertip elements) gets replaced.

    I suggest you give a class to all elements that should get the hover event handler (all parent elements of .hovertip). Then it’s easy

    Example:
    $(‘body’).on(‘hover’, ‘.hovertip’, function(){});

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

Sidebar

Related Questions

$(.hovertip).parent().live('hover', function() { ... The above code doesn't seem to register. This doesn't seem
I seem to be unable to change the onmouseover attribute of a div using
I am using FullCalendar v1.5.3 by Adam Shaw. I've gotten almost everything to work
I have created a jsFiddle for this question. a.tip { position: relative; } a.tip
I am finally getting around to really implementing some jQuery solutions for my apps
I have added an img tag inside title attribute,but the img tag shows as

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.