jQuery's DOM manipulation [continue]

A copy node
$ (selector string) .clone (false)     { return node object cloning ]
parameters:
false, shallow copy , copy elements event element but not bound replication [ defaults to false ]
to true , deep replication , replication elements and the replication event element bound
NOTE:
JS native of the cloneNode () method to copy nodes deep copy Representative copied subnode shallow copy Representative not copied subnode event not related to

two, node replacement    
function below some instructions:
a, parameters may be HTML string, DOM element or jQuery object
B, associated with a node will delete all data and event handlers

the replaceWith ()     [ replaced with self-node parameters ] [return] is replaced with element
Alternatively the set of all matching elements provided with the content and returns the deleted set of elements
eg:

    . $ ( 'div') The replaceWith ( '<span> Hello <span>');     // replace all div span nodes {node are replaced with each span div node]


replaeAll ()     [ itself alternative parameters node ]
Alternatively replaced with the node node The replaceWith () opposite
eg:

    $ ( '<span> Hello </ span>'). replaeAll ( 'div')     // replace all div span nodes {node are replaced with each span div node]


Third, the node wrapped          
wrap ([wrappingElement])
a html element on the outer envelope of each matching element.

wrapAll ([wrappingElement])
all the elements with a matching element to wrap, can be nested layers, the innermost layer but only one element.
All matched elements will be taken as a whole , wrapped with the specified HTML structure in the whole of the outside.

wrapInner ([wrappingElement])
of each element which matches the content (child elements) will be wrapped in such a configuration { matching elements which need to have the content; if an empty element is the last element package will appear empty html ]

Fourth, the Nodes     
note :
the following methods can be used to parse html and xml documents documents [ html files and documents can be converted to xml dom model ]
that in ajax, if backstage pass over the xml document is, then we can also do the following using jquery analytical methods      

children ([selector])     [ obtain a set of matching elements of the child elements ]
for obtaining matched child element set of elements
eg:

    $ ( "content.") Children ( "inner.");.     // get all child elements of [name of the class content and filter out the parameters have a child element named inner class of] 
    $ ( "content> .inner." );     // above effect is the same


find (selector)   [ get all descendants of all the elements matched elements in line with the parameters ]
look in the child element of the current element in the object, and all descendant elements that match the parameters
eg:            

    $ ( "content.") the Find ( "inner.");.     // All descendants of content get the class name of the class named inner elements of 
    $ ( "content .inner.");     // above effect is the same


next ([selector])     [ get the next sibling ]
made later siblings proximate each element in the set of matched elements.

nextAll ([selector])     [ Gets siblings behind ]
Find all siblings after the current element.
    
prev ([selector])     [ Gets the previous sibling ]
get matching elements immediately preceding sibling

prevAll ([selector])     [ get all of the previous sibling ]
Find all siblings before the current element

siblings ([selector])   [ get all siblings ]
made all siblings before and after the match element

closest (selector)     [ get recent matching elements ]
recent element acquisition and parameter matching, if the match is not to continue up to find a parent element

filter (selector)     [ continue filtering the original matching elements }
all the elements currently selected and then screened by filtration
    
parent ([selector])    [ Get parent element ]
to obtain the set of matched elements, each element of the parent element of the

parents ([selector])     [ Gets ancestor element ]
is obtained for each ancestor element in the set of matching elements

 

Guess you like

Origin www.cnblogs.com/nzcblogs/p/11266913.html