Append () is the selected element in theEnd Tag Front(that is, the interior of the selected element) inserts the specified content. After () is in the selected element'send tag behind(That is, the outside of the selected element) to insert the specified content. AppendTo ()is stillIn the selected element'sEnd Tag Front(that is, the interior of the selected element) to insert the specified content,It's just that the jquery function doesn't have the same wording.。 The difference between pretend () and before () is the same as the difference between append () and after (), slightly.
Source code used for analysis:
<!DOCTYPE HTML><HTML><HeadLang= "en"> <MetaCharSet= "UTF-8"> <title></title> <Scriptsrc= "Http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"></Script> <Scripttype= "Text/javascript">$ (). Ready (function(){ $("#button1"). Click (function(){ $("span"). Append ('<a href= "#" >append method </a>'); }) $("#button2"). Click (function(){ $("span"). After ('<a href= "#" >after method </a>'); }) $("#button3"). Click (function(){; $('<a href= "#" >appendto method </a>'). AppendTo ("span"); }) }) </Script></Head><Body> <span>The differences between the Append, after, AppendTo, pretend, before methods of jquery</span> <ButtonID= "Button1">Append</Button> <ButtonID= "Button2">After</Button> <ButtonID= "Button3">AppendTo</Button> <P>To see the difference, please F12 to see the source, right-click No</P></Body></HTML>
jquery Basics: The difference between append, prepend, after, before, Appendto