JQueryDOM object summary
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ the development tools and key technology in Visual Studio 2015 jQuery
Author: wen-jian tang
Writing time: on April 30, 2020,
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
In JQ object provides methods of JS can't use JS provides methods in JQ cannot use
Obviously in JQ compared with the operation of the JS JQ operation method is more convenient than JS, JS to memory operating method of a node
Browser is compatible and JQ doesn't have to go to tube compared to the amount of code JQ is far below the JS code,
How to get the JS object into a JQ object?
This method is very simple,
Column: DOM object into a jQuery object
Var box=document. GetElementById (" box ");//DOM object
$(box);//the jQuery object
The jQuery object into a DOM object
Column: var $divs=$(" div ") : this is JQ object
Var div=$divs [0] : this for the DOM object
Using the get () method in jQuery conversion, only need to provide an index can
Var div=$divs. Get (0);//$divs index of 0 element in the object into a DOM object
The common element in JQ for:
Var s=$(" # div ") for an element ID
Var s=$(" div ") to obtain a certain element of the tag
Var s=$(" div ") for an element class
Node deletion:
Remove: this can Remove node
The Empty: delete match all the child nodes in the collection
Detach (separation) : this method is different from the remove only the literal is removed, removed the data will be preserved,
Create nodes:
Created in JQ point method:
$(" body "), append (div); Explain the body for a div
$(" b "). AppendTo (v); Add in the b v
Var div=$(" & lt; Div class='box' & gt; This is a through the jQuery dynamically add div
" );