JQuery document analysis-Document Processing

Source: Internet
Author: User
Document Processing is to add html content 1, $ (& quot; p & quot;) to the dom element ;). append (& quot; & lt; ahref & amp; #39; www.baidu.com & amp; #39; & gt; baidu & lt;/a & gt; & quot ;); add content to the p label. 2, $ (& quot; p & quot ;). appendTo (& q document processing is to add html content to the dom Element
1,
$ ("P"). append ("baidu"); add content to the p tag
2,
$ ("P"). appendTo ("div"); add all p elements to the div.
3,
$ ("P"). prepend (" Hello"); Add all B elements before p
4,
$ ("P"). prependTo ("# foo"); add p to id foo ..
5,
$ ("P"). after ($ ("B"); add p to the end of B
6,
$ ("P"). before (" Hello"); Insert html before all p elements
7,
$ ("P"). insertAfter ("# foo"); insert p to the end of the element whose id is foo.
8,
$ ("P"). insertBefore ("# foo ");
$ ("# Foo"). before ("p") operations are the same. before inserting all elements into one element
9,
$ ("P"). wrap (""); wrap all p with div
10,
$ ("P"). unwrap () Remove the parent element of the p element
11,
$ ("P"). wrapAll (document. createElement ("div"); wrap all p
12,
$ (" Paragraph."). ReplaceAll (" p "); replace all p
13,
$ ("P"). empty (); Delete All subnodes in the p set
14,
$ ("P"). remove (); remove all p elements from the set
15,
$ ("P"). detach (". hello"); remove a paragraph with a hello class from the DOM
16,
$ ("B"). clone (). prependTo ("p"); copy Element B and add it to p.
Author: pingpang
Related Article

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.