38. Document operation of the front-end jquery

Source: Internet
Author: User

1. Document operations
Internal insertion
A.append (b) Bar B add to the back of a
A.appendto (b) Bar A add to the back of B
A.prepend (b) Bar B add to the front of a
A.prependto (b) Bar A add to the front of B
External insert
A.after (b) Bar B add to the back of a
A.insertafter (b) Bar A add to the back of B
A.before (b) Bar B add to the front of a
A.insertbefore (b) bar A add to the front of B
2. Cloning operations
$ (selector). Clone ();

Cases

<! DOCTYPE html>    $ (". C1"). On ("click",function  () {        $ () ). Clone (True). InsertAfter ($ (this))    })</script></body></ Html>

3. Replace operation

ReplaceWith (CONTENT|FN)
A.replacewith (b)-- B Replace a

ReplaceAll (selector)
A.replaceall (b)-- a replace B
// Replace all H5 titles with a label $ (' h5 '). ReplaceWith (' <a href= ' # ">hello world</a> ')//  Replace all H5 header tags with the DOM element ID for app $ (' h5 '). ReplaceWith ($ (' #app '));

4. Delete operation

When the node is deleted, the entire label is deleted

$ (' ul '). Remove ();

When a node is deleted, the event remains

Clears all descendants in the selected element child node

// EMPTY the UL sub-elements and keep the UL$ (' ul '). Empty ()

38. Document operation of the front-end jquery

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.