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

  • Home
  • SEARCH
  • 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

In this thread some one commented that the following code should only be used
Following from this thread: Another IE jQuery AJAX/post problem (please read the thread to
I use a jQuery function similar to the one in this thread: Easy way
I have ASP.Net code similar to the following (this is inside a FIELDSET): <ol>
It is possible to execute the following code from multiple threads simultaneously. this._sequencer.Completed +=
I have the following code that retrieves the first element off a queue only
Following this question: Good crash reporting library in c# Is there any library like
Following this example, I can list all elements into a pdf file import pyPdf
I've been following this tutorial (lesson 6) in order to build and deploy a
So I am following this guide: http://technotes.1000lines.net/?p=23 and I am going through the steps.

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.