RemoveChild () function usage in JavaScript and removechild
The removechild function can delete the specified child element of the parent element.
If this function successfully deletes a subnode, the deleted node is returned. Otherwise, null is
Javascript removeChild () is used to delete nodes and subnodes. javascript deletes nodes.
The following describes how to delete a node using Javascript removeChild (). The details are as follows:
In Javascript, only one method to delete a node is
When you operate the DOM tree in Javascript, you may often encounter adding and deleting nodes. For example, you can add a button and delete a button after an input box and click Add to add an input box, click Delete to delete the corresponding
To verify, I wrote a page to validate how memory leaks. The code is as follows
Copy Code code as follows:
Test Memory leaks
Create Elements
[BR]
Delete Elements
[BR]
Test div is still there
1, append and delete HTML elements Creating HTML Elementsvar newele =document.createelement ("P");The created element is appended to another element:A. AppendChild (b): If B is a new element, add element B at the end of all child elements of the A
1. Overview
The deleted node, although not in the document tree, is still in memory and can be added to another location at any time.
When you traverse a child node of a parent node and perform a delete operation, note that the Children property
I used to think that I added a listening event to an object and then removed it. Then, his event will not be executed. In fact, this is an error!
As3 is not Js. Its display, storage, and time listening are independent. It will not be deleted
Because I used to be. net programmers, so even if you are working on the front-end, you are also used to writing js scripts in an object-oriented way. I think if you were or are still a third-generation programmer, you should be familiar with this.
Before IE8 and firefox3.6, the page loads external JavaScript files (IE6, 7 will block together with images, style resources, and page rendering). In later versions, browsers all use waterfall loading, which makes page opening and rendering faster.
Native JS sends asynchronous data requests, js asynchronous
Asynchronous data requests are sometimes required for projects. However, if there is no framework dependency at this time, native JS is required for asynchronous data requests. At this time,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.