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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:12:23+00:00 2026-05-23T19:12:23+00:00

Is there a proper way to rebind events in JQuery UI when tabs are

  • 0

Is there a proper way to rebind events in JQuery UI when tabs are loaded via ajax. For example, in the code below, I have the success event call an ‘initBinding()’ function which sets up some custom click event handlers for different classes. The problem with this is, when I switch tabs a bunch of times, then fire off one of the click events, I get some weird screen flicker effects. If I refresh the entire page, then go directly to the click event, it doesn’t flicker. So I think it has something to do with it binding multiple times.

If I take the ‘initBinding()’ method out of the success event, any tab that gets loaded via ajax will not trigger any of the events I have setup. Is there a standard/better way to do handling binding events like this?

$(document).ready(function () {
    $("#tabs").tabs({
        select: function (event, ui) {
            var tabID = "#ui-tabs-" + (ui.index + 1);
            $(tabID).html("<b>Fetching Data....Please wait....</b>");
        },
        ajaxOptions: {
            error: function (xhr, status, index, anchor) {
                $(anchor.hash).html("Could not load tab data");
            },
            success: function (xhr, status, index, anchor) {
                initBinding();
            }
        }
    });
});
function initBinding() {
    $(".editButton").click(function () {
        //event logic...
    });
}
  • 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-23T19:12:25+00:00Added an answer on May 23, 2026 at 7:12 pm

    You should use jQuery’s .live() to

    Attach a handler to the event for all elements which match the current selector, now and in the future.

    In your code:

    $(".editButton").click(function () {
    

    will become

    $(".editButton").live('click', function () {
    

    Using this technique, you can remove the initBinding() function altogether, and use the .live() statement in the onready function.

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

Sidebar

Related Questions

Is there a proper way yet to unit test views with the aspx view
I wonder, if there is a proper way to remove the default close button
I distribute software online, and always wonder if there is a proper way to
What's the proper way to create a hyperlink in Spring+JSP? There must be a
This might be a stupid question but if there's a better or proper way
There have been several questions over the past few days about the proper use
Is there a proper way in Poco to abort a blocking I/O operation from
Is there a 'proper' way to iterate over a two-dimensional sequence in Clojure? Suppose
is there a way to group a matching element but not have that match
Example code: http://jsfiddle.net/slolife/PnmxM/ I am asking this even though there are a number of

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.