Use jQuery to operate DOM and jquery to operate dom
I. DOM operations are divided into three categories
1. DOM Core
DOM Core is not a specialized product of Javascript. It can be used by any programming language that supports DOM. Its purpose is not limited to processing a document written in a markup language.
2. HTML-DOM
It appears earlier than DOM Core and provides more concise markup to describe the element attributes of various HTML-DOM
3. CSS-DOM
CSS-DOM loss of CSS operations, in JavaScript, as long as the role is to get and set the style Object Attributes
Ii. style operations
1. directly set the style Value
Css (name, value) // sets a single attribute
Css ({name: value, name: value, name: value...}) // set multiple attributes
2. append and remove styles
AddClass (class) // append Style
RemoveClass (class) // remove a style
3. Switch the style
TaggleClass () // you can switch the class styles of different elements.
Iii. Class capacity operations
1.html code operations
Html ([content]) // (optional) specifies the new category of the alternative element. This parameter can contain HTML tags. If no parameter exists, it indicates the Text Category of the selected element.
2. Label operations
Text ([content]) // optional, specifying the new text class of the selected element. annotation. special characters are encoded. If no parameter is specified, it indicates obtaining the selected class capacity of the element.
3. Attribute Value operation
Val ([value])
Iv. node attribute operations
1. Search for nodes
$ ("Xxx ")
2. Create a node
$ (Selector) // selector
$ (Element) // Dom element
$ (Html) // html code
3. Insert a node
Internal insertion: append (content) appendTo (content) prepend (content) prependTo (content)
External insertion: after (content) insertAfter (content) before (content) insertBefore (content)
4. delete a node
$ (Selector). remove ([expr])
5. Replace nodes
$ ("Ul li: eq (1)"). replaceWith ($ xxx)
6. Copy a node
$ (Selector). clone ([includeEvents])