<script type= "Text/javascript" >$ (document). On ("click", ". Append", function () {$ (". One p"). Append ( "<div>CSDN</div>");//Inserts the specified content at the end of the selected element (still inside). Append element after P}) $ (document). On ("click", ". AppendTo", function () {$ (' <div class= "). AppendTo ('. two p ');//append () and appendto () methods perform the same tasks. The difference is: the location of the content and the selector. }) $ (document). On (' click ', '. After ', function () {$ (". Three p"). After ("<div>SCDN2</div>");// Inserts the specified content after the selected element. Append the element//$ ("selector") to the back of P. After ("What to insert");}) $ (document). On ("click", ". InsertAfter", function () {//$ (". Four p"). InsertAfter ("<div>SCDN3</div> "); $ (" <span> Hello! </span> "). InsertAfter (". Four p "),//$ (" What to insert "). InsertAfter (" selector ");}) $ (document). On (' click ', ". Before", function () {$ (". Five p"). Before ("<span>hello world!</span > ");//Insert the specified content before the selected element. Append the element//$ ("selector") to the front of P. Before ("What to insert");}) $ (". InsertBefore"). Click (function () { $ ("<span>Hello world!</span>"). insErtbefore (". Six p");//$ ("What to insert"). InsertBefore ("selector");}); /Add insert and do not insert the same task, different is the location of the content and selector </script>
This article is from the IT technology blog, so be sure to keep this source http://linuxubuntu.blog.51cto.com/4964714/1793946
Jqery append appendTo after InsertAfter before usage