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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:19:11+00:00 2026-05-26T18:19:11+00:00

I have a click bound as live to an element. The handler returns false

  • 0

I have a click bound as live to an element. The handler returns false after execution, but if the element happens to be an A tag, then the link is also not followed, which is unacceptable…

$('*').live('click', function(){
  // lots of code here
  return false;
});

Now if the element that is clicked on has a path like A>img and the image is clicked on, the A will never be followed. I dont want the click event to propagate any further.

how do I achieve this?

Edit:

It is essential for my application to bind the event to *. Also, the clicks can be made on any element, not just A’s. Thus none of the mentioned solutions are suitable for what I wish to achieve.

  • 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-26T18:19:12+00:00Added an answer on May 26, 2026 at 6:19 pm

    I would not bind a click function to *. You could bind it to the body element; the click will propagate from the element that was clicked to the body element. You can check the element that was originally clicked like this:

    $("body").live("click", function (e) {
        if ($(e.originalEvent.target).is("a")) {
            return false;
        }
    });
    

    Having said that, you can still do this:

    $("*").live("click", function () {
        if ($(this).is("a") == false) {
            return false;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Usually, when people click on a link, I have onclick bound to it. And
I have a Javascript function bound to the click event of an INPUT element
I have some functionality which is bound to a click event: $('.addButton').live('click', function(){ //stuff
If I have following in jQuery $(#someId).add(#someOtherId).bind(click, function(e) {... I get the click bound
I have the following code bound to the click event of a button: function
I have 2 click handlers binded to an element like so: in the file
I have a click handler, which has event.preventDefault. There is whole lot of logic
I have a click function bound to many elements. It is possible that sometimes
I have a div with a click event bound to it. I want to
I have two types of links that are event-bound. If the clicked-on link has

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.