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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:07:41+00:00 2026-05-28T04:07:41+00:00

So typically I just use stopPropegation when I need to prevent the default action

  • 0

So typically I just use stopPropegation when I need to prevent the default action of the parent when a child is clicked. However, this doesn’t seem to be work with live elements. So I had the idea to temporarily remove the onclick attribute of the parent when the child is hovered over. I seem to be able to remove it just fine, but I cannot seem to be add it back to the element… this is what I came up with…

$('body').delegate('.button', 'mouseenter mouseout', function(e){
        if(e.type=='mouseenter'){
          var inside = $(this).parents('.post').attr('onclick');
          $(this).parents('.post').attr('onclick','');
        }else if(e.type=='mouseout'){
          $(this).parents('.post').attr('onclick', inside);
        }
    })

So this will remove the element successfully, however the attempt to add it back is always unsuccessful… it just comes up empty. Can anyone give me a hand here? I’m completely stuck. I’d also be happy with alternative method to achieving the same result. Thank you.

  • 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-28T04:07:41+00:00Added an answer on May 28, 2026 at 4:07 am

    try this http://jsfiddle.net/kDuNU/4/:

    $('div').live('click', function(event) {
        if ($(event.target).hasClass('button'))
           return;
        alert('hello');
    });
    
    $('.a-span').live('click', function (event) {
        alert($(this).text());
    });
    $('div').append('<span class="a-span button">another</span>');
    
    <div> hello <br/>
        <span class="a-span">world</span>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Typically if we just use alert(object); it will show as [object Object] . How
Typically, when I use lambdas, I just use a, b, c, d... as variable
I typically use the site http://www.pinvoke.net/ to grab a DllImport declaration whenever I need
I have this kinda interesting requirement. Typically you use XSLT to transform an XML
I typically use URL rewriting to pass content IDs to my website, so this
I'm familiar with and use shutdown in Linux, and typically just do > shutdown
With my database upgrade scripts, I typically just have one long script that makes
Okay. I know this looks like the typical Why didn't he just Google it
Typically I use E_ALL to see anything that PHP might say about my code
When using reflection we typically just was the basic System.Reflection API but I am

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.