开发者

Delete object from memory in javascript

I am working on an AJAX application with a lot of Javascript. All pages are loaded through AJAX.

On a certain page I have a grid which is build in Javascript. Now when I leave that page I want to destroy that grid. I call jQuery.remove() but this only deletes the object from the DOM.

My question is how can I delete this grid object from the memory? Cause it still exists when I move away from the page.

Much appreciat开发者_JS百科ed!


If you delete all references to your grid (i.e. assign null to the variable), the garbage collector will delete the object from memory.


put the grid into a div or anything you want. when you want to delete it use

$("<the name of the div>").empty();

that will clear it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜