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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:13:55+00:00 2026-05-14T04:13:55+00:00

So today I just came across the ‘live()’ function that binds any future and

  • 0

So today I just came across the ‘live()’ function that binds any future and past elements to the whatever event you choose, such as ‘onclick’.

Right now I’m having to set up buttons like the following each time I load a new button via ajax …

$('a.btn.plus').button({icons:{primary:'ui-icon-plusthick'}});
$('a.btn.pencil').button({icons:{primary:'ui-icon ui-icon-pencil'}});
$('a.btn.bigx').button({icons:{primary:'ui-icon ui-icon-closethick'}});

So, instead of calling these lines each time I use ajax to add a new button, is there a similar way to tell JQuery to setup my buttons ANYTIME I add new ones?

Thanks for any help!

  • 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-14T04:13:56+00:00Added an answer on May 14, 2026 at 4:13 am

    Mmh not really. But there is the function .ajaxSuccess() which is triggered whenever an Ajax call is successful. So you could do:

    $('body').ajaxSuccess(function() {
        $('a.btn.plus').button({icons:{primary:'ui-icon-plusthick'}});
        $('a.btn.pencil').button({icons:{primary:'ui-icon ui-icon-pencil'}});
        $('a.btn.bigx').button({icons:{primary:'ui-icon ui-icon-closethick'}});
    });
    

    But this will run on any links with the classes, not only on the new ones. But if you append them on a time (i.e. not multiple a.btn.plus at once) you might be able to use the :last selector (a.btn.plus:last).


    You can also create a function and just that from your callback functions:

    function links() {
       $('a.btn.plus').button({icons:{primary:'ui-icon-plusthick'}});
       $('a.btn.pencil').button({icons:{primary:'ui-icon ui-icon-pencil'}});
       $('a.btn.bigx').button({icons:{primary:'ui-icon ui-icon-closethick'}});
    }
    

    and in the Ajax call:

    $.ajax({
       //...
       success: function(msg){
          links();
       }
    });
    

    This way you can pass the parent element to the function in order to find the link only inside this element (so the code would only work on the new links).


    A last option would be generate a custom event but in the end this would be similar to just doing a function call in your case so you gain not much.

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

Sidebar

Related Questions

Just today I came across third-party software we're using and in their sample code
I just came across something that I have not seen before and I thought
I came across this Perl construct today: @foo = split(\n, $bar); That works well
I just came across Clang/LLVM today , and decided to try it out. My
I just came across this weird behavior today: interface IFooBar { void Foo(); void
I know the bits just came out today, but one of the first things
Just today I noticed on our Wordpress blog that the Facebook iframe is showing
I just started learning MVC3 today, so please forgive any stupidity (particularly a poorly
1) I came across THIS ARTICLE today, which states: The most popular method in
I came across the following URL today: http://www.sfgate.com/cgi-bin/blogs/inmarin/detail??blogid=122&entry_id=64497 Notice the doubled question mark at

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.