Document processing: Append (), Appendto (), prepend (), after (), before (), Clone ():
Append is the addition of the content inside the element, within the element, after the content,
The appendto is to append the existing content to the element, after the element, the content, and the HTML to replace all of the current content.
Append (): Method inserts the specified content at the end of the selected element (still inside), example:
var html = "<div id= ' test ' title= ' Hi ' >1234567</div>"
$ ("#diva"). Append (HTML);
<div id= ' test ' ><div id= ' test ' title= ' Hi ' >1234567</div></div>
Appendto (): content appended to an element, example:
<p>eat chicken</p>
$ ("P"). AppendTo ("div");
<div><p>eat Chicken: </p></div>
Prepend (): Appends some elements to an element, as an example:
$ ("P"). Prepend ("<b>Hello</b>");
<p><b>hello</b>eat chicken</p>
After (): Append element after element, example:
$ ("P"). After ("<b>Hello</b>");
<p>eat Chicken: </p><b>Hello</b>
Before (): Insert element before element, example:
$ ("P"). Before ("<b>Hello</b>");
<b>hello</b><p>eat Chicken: </p>
Wrap the element with a newly created element, for example:
$ ("P"). Wrap ("<div class= ' wrap ' ></div>")
<div class= ' Wrap ' ><p></p></div>
Empty (): The child elements of all elements (including text nodes) are deleted, examples:
<p>hello, <span>Person</span> <a href= "#" >and person</a></p>
$ ("P"). empty ();
<p></p>
Clone (): Clones an element and prepend to an element:
$ ("B"). Clone (). Prependto ("P");
<p><b></b>eat chicken</p>
jquery document Processing