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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:09:29+00:00 2026-05-17T23:09:29+00:00

following up on this thread jquery: live() – only lives once? I found out

  • 0

following up on this thread jquery: live() – only lives once? I found out what the problem is in my code whether I use live() or bind() – I have this line below after using load(),

$('.disabled').click(function(){return false;});

If I don’t use this line the page will ‘return’ the link in the a tag if I click on the button again. for instance, this is the first button (a text link button) –

<a href="another_page.php">button 1 </a>

what have I done wrong by adding that line? any idea how I can resolve this…?

below is some more code of this function I am trying to resolve this problem,

$('.load-item-news:not(.disabled)').bind('click',function(){

        ...

        /* add a .current class to the target item */
        $(this).parentsUntil('.column-global').addClass('current');

        /* add .disabled class to each a tag in the .current element-div */
        $('.current a').addClass('disabled');

        ...

        /* prepend a fresh div */
        $('.column-global.right').prepend('<div class="wrapper-item"></div>');

        ...

        var path = $(this).attr('href');
        var item_wrapper = $('.wrapper-item');

        var array_path = path.split('/');
        var pg_url = $(array_path).last()[0];

        item_wrapper.load(http_root+rp_template+'item_content_news.php?pg_urlx='+pg_url, function(){

            ...

            $('.disabled').click(function(){return false;});
            //$('.current a').click(function(){return false;});

        });

        return false;
    });

thanks.

  • 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-17T23:09:30+00:00Added an answer on May 17, 2026 at 11:09 pm

    When you do this:

    $('.disabled').click(function(){return false;});
    

    …you do two things by returning false:

    1. You prevent the browser default (like event.preventDefault()), and

    2. You prevent the event from bubbling up the DOM (like event.stopPropagation()).

    If you only want to do one or the other (like just preventing the default), you can do that:

    $('.disabled').click(function(event){ event.preventDefault(); });
    

    That way you’re preventing the default action but not stopping bubbling, and so any live handler you have should eventually be triggered.

    But I wonder if you really want to be doing this. I’m guessing if a link can have the class “disabled”, that it can be “enabled” sometimes? Just removing the “disabled” class won’t turn off that click handler (that’s part of what live is for, handling changes for you). For instance:

    $('.disabled').live('click', function(event){ event.preventDefault(); });
                // ^^^^^^^^^^^^^-- Note the change
    

    …tells jQuery that rather than looking for elements that have the class “disabled” now, you want it to check when the click occurs and only run the handler if the element matches at that point in time.

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

Sidebar

Related Questions

Following from this thread: Another IE jQuery AJAX/post problem (please read the thread to
Following leads in this thread and others, I've set up a code block where
I use a jQuery function similar to the one in this thread: Easy way
Following this thread, I tried to upload a file on the server. If I
Following this code my button works perfectly: http://twitter.github.com/bootstrap/javascript.html#modals Fades and everything. I want to
Following this question , I use this function to convert arrays to objects, function
Following this thread: How to handle functions deprecation in library? I want to find
The following thread provided me with a neat script to swap out div content
I am following this thread to disable/ enable the click on a button, Best
Following code for passing an object to event handler is not working: $('a.another').live('click', function(e,

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.