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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:54:12+00:00 2026-05-24T17:54:12+00:00

I bind to a link (by using the .live() function of jQuery) click event

  • 0

I bind to a link (by using the .live() function of jQuery) click event and then manually add an onclick event handler with pure JS and HTML (like <a href="".... onclick="some action">). I want to prevent bubbling of the event to the live method but I don’t know how.

Maybe e.stopPropagation() is helpful in this situation but the event handler added with onclick is written in pure JS and I can’t call stopPropagation() from outside the jQuery element wrapper. return false in this situation does not work. I tried to substitute return false with $.Event('click').stopPropagation() but I think this is wrong as it did not work.

How to prevent bubling to live() method without jQuery wrapper?

  • 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-24T17:54:13+00:00Added an answer on May 24, 2026 at 5:54 pm

    With .live, you cannot stop propagation. This is because with .live, the event handler is bound to the root of the DOM tree. Hence the event must bubble upto the highest element before your handler can be called. Its one of the caveats on using .live.

    Consider using .delegate (if you want the handler to persist) or use .bind instead.

    If you want the live handler to be disabled completly, use die:

    $("#myHref").die("click", aClick); // this will remove any existing event handlers
    $("#myHref").click(yourhandler);   // add your handler
    

    Demo 1: JsFiddle 1

    Or, add an inline handler (and cancel the event from there):

    <a href=".." onclick="yourhandler">
    

    Demo 2: JsFiddle 2

    Inline handlers will be called first always before any jquery event handlers.

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

Sidebar

Related Questions

I defined a simple function and attached a click handler to a link using
I have a problem, I'm using .live() to bind mouseenter like this: $('a').live('mouseenter',function(e){ alert($(this).attr('title'));
I have a link where I need to be click it automatically using jquery
I'm new to jquery and having a problem using .delegate() to bind a function
I am using jQuery bind, detach, etc. and I found this link . Please
Here's my application.js file. I'm using the jquery-embedly API: $(document).ready(function() { $('a.oembed').embedly({maxWidth:500,'method':'replace'}).bind('embedly-oembed', function(e, oembed){
Submitting a form using a link powered by jQuery is what I am curious
I am currently running the below code to parse an HTML link using HTML
I'm working on 'add a link' functionality. For that I'm using Modal plugin from
I have one link button with a click event. When Clicked I want to

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.