Jqery append appendTo after InsertAfter before usage

Source: Internet
Author: User

<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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.