DOM
Divided into three main operations, DOM Core
, HTML-DOM
andCSS-DOM
Find node
Find an element node
Mainly through jQuery
the selectors to find elements node
Find property node
You may be used to look after the element node attr()
to find the corresponding node or set properties
Create a (child) node
Using $(html标签代码字符串)
a node is created, and then use the following methods to insert a node; while the following method may also move the original element node
append()
Additional content to match the interior of each elementappendTo()
All matched elements added to the specified elementsprepend()
The contents of each element of the internal head matchesprependTo()
All the elements of the pre-match to the specified elementsafter()
Insert after each matched elementsinsertAfter()
All the elements that match the specified element is inserted into the rearbefore()
Inserts before each matching elementinsertBefore()
All matched elements inserted in front of the specified element
Delete Node
remove()
Delete all matched elements from the DOMdetach()
Cut all the matches from the DOM elements, events, and additional data retentionempty()
Clear all matched elements from the DOM descendant element node
Copy nodes
clone()
Copy the elements match
Replacement Node
replaceWith()将所有匹配的元素用特定内容替换
replaceAll()
The same effect, reverses the relationship between the guest of honor