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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:58:35+00:00 2026-06-08T11:58:35+00:00

In the jquery documentation of the empty function (http://api.jquery.com/empty/) there is the following statement:

  • 0

In the jquery documentation of the “empty” function (http://api.jquery.com/empty/) there is the following statement:

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

The text says: “… jQuery removes event handlers from the !C H I L D! elements …”. But I want the event handlers also removed from the div tag ($(“#mydiv”).empty). I know that there is the function “remove”, but my intention is to not remove the div tag. What is the best way to get this done?

The other thing is:
When they say “remove event handlers”. Do they only remove constructs made with “bind” or do they also remove constructs made with “delegate”?

Thanks alot 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-08T11:58:36+00:00Added an answer on June 8, 2026 at 11:58 am

    To remove all bound event handlers from an element, you can pass the special value "*" to the off() method:

    $("#mydiv").empty().off("*");
    

    When the documentation says remove events handlers, it only speaks of bound event handlers, not delegated ones, since these are bound to an ancestor element (or the document itself) which is not impacted by the removal.

    This allows delegated handlers to keep working as intended if the removed element is reinstated later.

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

Sidebar

Related Questions

The jQuery documentation lists the following example of using $.getJSON to request JSONP: $.getJSON(http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?,
The following is an excerpt from jQuery documentation Code examples Supply a callback function
If I am reading correctly the documentation on: http://jquerymobile.com/demos/1.1.0/docs/api/methods.html Using pageContainer and role should
jQuery documentation indicates the following is returned: success(data, textStatus, XMLHttpRequest)Function A function to be
I read that docs.jquery.com uses wiki to do the API documentation. I have been
The jQuery documentation covers the function jQuery.extend()s twice, giving it different definitions. The first
I found it in Jquery documentation that fadeOut() accepts callback function but in my
Can anyone explain what the jquery documentation is exactly referring to with this statement:
I saw on the jquery documentation that live() is deprecated. Is there a direct
I'm using the following jQuery code to try and access the delicious api, but

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.