Some simple tests, tools sublime text, Firebug
Append appends content to each matching element.
eg
<PID= ' P1 '>Text</P><Scripttype= "Text/javascript"> vartext="" $(function(){ $("#p1"). Append ($ (text)); });</Script>
after performing the above after the code, the Firebug in-memory tag information becomes
<id= "P1"> text <H2> This is a H2 </ H2 > </ P >
The Append function in jquery is to insert text into the specified label.
AppendTo: Appends all matching elements to another specified set of element elements
<PID= ' P2 '>Text</P> <H2>A</H2> <H2>B</H2><Scripttype= "Text/javascript"> $(function(){ $("#p2"). AppendTo ($ ("H2")); });</Script>
in the page The display effect code is as follows
<H2>a<PID= "P2">Text</P></H2><H2>b<PID= "P2">Text</P></H2>
contrary to append, Appendto is to cut and copy the original label into the specified label .
Prepend: Front content to each matched element.
<PID= ' P3 '>Text</P><H3>A</H3><H3>B</H3><Scripttype= "Text/javascript"> $(function(){ $("#p3"). Prepend ($ ("H3")); });</Script>
page Effects
<id= "P3"><h3>a</ H3 > < H3 >b</h3> text </p>
got the same results as append.
Prependto: puts all matching elements in front of another, specified set of element elements.
<PID= ' P4 '>Text</P><H1>A</H1><H1>B</H1><Scripttype= "Text/javascript"> $(function(){ $("#p4"). Prependto ($ ("H1")); });</Script>
page effect
<H1><PID= "P4">Text</P>a</H1><H1><PID= "P4">Text</P>b</H1>
The same effect as Appendto
After: Inserts the content after each matching element.
<PID= ' P5 '>Text</P><Scripttype= "Text/javascript"> $(function(){ $("#p5"). After ($ ("")); });</Script>
Test results
<id= "P5"> text </p>< H2 > This is an after test </h2>
After is appended to the label body, there is no content intersection of the original label
Before: Insert content before each matching element
<PID= ' P6 '>Text</P><Scripttype= "Text/javascript"> $(function(){ $("#p6"). Before ($ ("")); });</Script>
Page effects
<id= "P5"> text </p>< H2 > This is a before test </h2>
Before before inserting to label
Document processing of the work-jquery in the Week Four (part)