Create node and node properties with internal insert append () and Appendto ()
1 Creating a process
creating nodes (common elements, attributes, and text)
Add some properties of a node
Adding to the document
2 methods involved in the process
Creating an element document,creat
Set Property Setattrilbute
Add text innerHTML
Add to document AppendChild
3 When creating a node note: Each element node must be created separately, the node is the attribute needs to be set separately, and the interface set is not very uniform, add to the specified element location is not flexible, browser compatibility problem processing
4 Creating ELEMENT nodes it is common to directly describe the structure of this node through an HTML tag string, which is handled by the $ () function ("HTML structure") such as $ ("<div><div>")
5 Create as this node similar to creating element nodes, you can directly describe the text content, such as $ ("<div> I am a text node </div>")
6 Create the same way as the attribute node as the element node is created, such as $ ("<div id= ' test ' class= ' Aaron ' > I am a text node </div>")
7 Append this operation is similar to the case where the native AppendChild method is performed on the specified element, adding them to the document
8 Appendto Use this method to reverse the normal $ (A). Append (b) operation, not to append B to a, but to append a to B
9 append () and Appendto () methods of operation
Append (content) appends contents to each matching element
AppendTo (content) appends all matching elements to another specified set of elements
Append () and. AppendTo () are functionally identical, the main difference being the location of the syntax, content, and target
append () front is the inserted object, followed by the content of the element to be inserted in the inward
AppendTo () is preceded by the element content to be inserted, followed by the inserted object
append () and. AppendTo () All insert the specified content at the end of the selected element (still inside)
dom--Create node and node properties with internal insert append () and Appendto ()