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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:26:33+00:00 2026-06-16T04:26:33+00:00

Having a code like this, I’m wondering if I ran this function a second

  • 0

Having a code like this, I’m wondering if I ran this function a second time, which scenario will happen:

  1. When emptying the #deals tag, all btn inside will get wiped as well despite the event on them and life is good.
  2. I have to unsubscribe from those btn first, otherwise emptying the #deals tag leads to a memory leak?
  3. List item

Code:

function test(){
    var row = $(this).closest('tr');  
    $(row).find('#deals').empty();

    $(result).find('#tab li a').each(function() {               
      var btn = $('<a/>', {class: 'btn', href: '#'});

      $(row).find('#deals').append(btn);

      btn.click(function(event){
          event.preventDefault();
          ...
         });
    });
}
  • 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-16T04:26:35+00:00Added an answer on June 16, 2026 at 4:26 am

    You don’t have to unsuscribe :

    To avoid memory leaks, jQuery removes other constructs such as data
    and event handlers from the child elements before removing the
    elements themselves.

    (from the documentation)

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

Sidebar

Related Questions

I ran across some code like this today; having a flow control flag that
I am having an issue converting type. I was trying code like this (minimal,
How to convert the text file through vb6 code. Having filename like clock.fin, time.mis,
I'm a programming newbie having difficulty with Python multiplication. I have code like this:
I recently came across some code like this: parent && parent.removeChild(this); Which takes the
Having code like this: class A { public A(int x) {} } class B:A
Having some pain with this event, I have some code like this for a
Say you write some code like this (using ruby-mode, but I've seen this happen
having code like this: public static readonly bool MaximumRecipientsReached; private static readonly IList<EmailAddress> Contacts;
I am having code like this: var input = $('input'); var select = $('select');

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.