How to Remove DOM Element with JQuery

Remove DOM Element with JQuery:



Relation of JQuery and DOM

JQuery is one of the most famous JavaScript libraries online. There are so many articles in the web about it, that I feel useless to describe it again. The good parts of that library are the amazing way it handles the DOM. It is so good at that that I usually use it with other JavaScript libraries.

Now I’m working on a task and one of the main target of the completed task was the RAM usage of the code. It just has about 100 dynamic DOM elements which on every event should be removed form the tree and the RAM should be freed.

First step Unbind first:

The first simple sub-task was to remove the event listeners. The problem is that if you don’t remove the event listeners may result in memory leaks in JS. The way JQuery removes the event listeners is with:
$(element).unbind()
That’s enough. Now the element don’t have any event listeners attached to it.

second step Remove Elements:

Now you must just remove the element from the tree with no fear of memory leaks, with just writing:
$(element).remove()

 JQuery related Other Post


·                     JQuery UI Datepicker (Calendar) with asp.net textbox
·                     What is the Ajax colorpicker,How to use Ajax colorpicker
·                     Ajax ColorPickerExtender in ASP.NET Example
·                     jquery tooltip with css in asp.net web page
·                     Drag and Drop Sortable Lists using jQueryUI
·                     How to Play YouTube Videos in Asp.net by using Jquery 
·                     Use jquery of change Opacity on Mouse over,
·                     Asp.net jQuery Open YouTube Video in Modal POPUP.
·                     How to Play YouTube Videos in Asp.net by using Jquery
·                      jquery disable or Enable submit button after validation
·                      Get current datetime in jquery and javaScript
·                      JQuery UI Datepicker (Calendar) with asp.net textbox
·                      jQuery modal dialog with postbacks,
·                      Drag and Drop Sortable Lists using jQueryUI,
·                      jQuery Zoom Image on Mouseover in asp.net using jQuery,
·                      In asp.net by jquery change div text color on mouseover ,
·                     Jquery Change div background on mouseover in asp.net ,
·                     Dynamically creating aspx page,
·                     Asp.net :Difference between Authentication and Authorization
·                     Object Pooling in .NET and how to use Object Pool
·                     ASP.NET : Types of authentication and authorization


Comments