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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:41:02+00:00 2026-06-01T03:41:02+00:00

I am making a module for the Joomla! page of a client that uses

  • 0

I am making a module for the Joomla! page of a client that uses Ajax to render different queries to the database. The result of these queries is that I regenerate the entire HTML code of the different DIVs. Within my jQuery Object I have a function named as cache() that stores all objects that I need to attach them the different events. My problem is that every time I regenerate the HTML code from any of these divs, I have to rebuild all the objects, so I’ve created a new function recache() to make this work more easy.

I guess this is not the best procedure.
Is there any way to keep alive these handlers without having to call this function cache() each time, or is there any way to rebind dynamically this objects?

Thank you!

Here my code:

    var Object = {
        init: function() {
            this.cache();
            this.bindEvents();
            return this;
        },

        cache: function() {
                   OBJECTS....
                       this.nameObject = $('#anchor');
                       etc..
        },

        recache: function() {
            Objects to be recached as needed.
        },

        bindEvents: function() {
            EVENTS attached to the objects. 
                        this.nameObject.on( 'click', 'context', this.nameFunction );

        },

                    nameFunction: function() {
                        #CODE....
                    }

                }; //END Playlist (Object)

window.Object = Object.init();

I usually use on() function instead of delegate(), live() or bind(), butI’m not sure this is exactly my problem.

Thanks in advance!

  • 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-06-01T03:41:03+00:00Added an answer on June 1, 2026 at 3:41 am

    You hinted at the right plan: use .on(). Remember though that when you’re delegating a listener, you need to delegate to a listener that will not be destroyed.

    Or in other words:

    // will not do anything useful for this scenario:
    $('.something').on('click', function() { /* ... */ });
    

    is different from

    // use the document as a listener: will work but not efficient
    $(document).on('click', '.something', function() { /* ... */ });
    

    which is different from

    // use a closer ancestor that is NOT destroyed. Best option if you can
    $('#someAncestor').on('click', '.something', function() { /* ... */ });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a small test framework that uses the JavaScript module pattern for UI
I've just created a module for Joomla 1.6 that uses jQuery for its animation.
I'm making a webservice that acts as user authentication module. You can add roles,
i m making add,edit delete module...For that i have the following code in the
I'm making a drupal 7 module that contains a form and I would like
I am making a custom module which also enables an edit page to edit
I'm making a module in the ./addons/shared_addons/modules/ directory. The module's called render . From
I'm making somewhat of a module that gets included into another unrelated PHP application.
I am making a sequence of Ajax calls using the Ext.Direct module. I want
i am making a module which would generate and transmit ip packets for voice.

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.