jquery Learning Note manipulation jquery Object document processing _jquery

Source: Internet
Author: User
Here are some common methods, in the form of $ (selector). method, where $ (selector) is the currently selected element:

Moving elements

Method

Describe

Append ($ (selector))

Append to the inner part of the current element

Appendto ($ (selector))

Appends the current element inside an element. But because the current element is moved as needed, the jquery object changes and can be restored with end ()

Prepend ($ (selector))

Internal front content to the current element

Prependto ($ (selector))

The current element is placed in front of an element. Similar to Appendto (), will change the object

After ($ (selector))

Inserts content after the current element

InsertAfter ($ (selector))

Inserts the current element after an element. Similar to Appendto (), will change the object

Before ($ (selector))

Inserts content before the current element

InsertBefore ($ (selector))

Inserts the current element before an element. Similar to Appendto (), will change the object

adding elements

Method

Describe

$ (HTML)

Create a build jquery object. Creates a JQuery object that points to the new element based on the original HTML code string, and then uses the Move method to add it to the document

Clone ()

Replication generates jquery objects. Copies the currently selected page element, generates the jquery object for the replica element, and also uses the Move method to add to the document. and the Clone () points to the replica, which is equivalent to changing the jquery object, so you can restore the current selected element with one end (), and the second-end () to completely restore the changes to the jquery object

Replace element

Method

Describe

ReplaceWith ($ (selector))

ReplaceWith ($ (HTML))

Moves the original element on the page to replace the currently selected page element, or you can add a new element to replace the

ReplaceAll ($ (selector))

ReplaceAll ($ (HTML))

Replaces an element with the currently selected element, either to make the original element on the page, or to be a new element. The same copy of the current element is replicated as needed to change the jquery object

Parcel Element

Method

Describe

Wrap ($ (selector))

Wrap ($ (HTML))

Copy the original elements on the page to wrap the currently selected element or add new elements to wrap

Unwrap ()

is used to remove the parent element of the current element, but the textual content within the parent element remains

Wrapall ($ (selector))

Copy the original element of the page wrap all the currently selected elements together, unlike wrap () wrap each element separately

Wrapinner ($ (selector))

Copy the original element of the page to wrap the text and descendant elements within each of the currently selected elements, unlike wrap (), which wraps each element individually

deleting and emptying elements

Method

Describe

Remove ()

Deletes the current element that contains the text content and descendant elements that are deleted together, and the bound event no longer exists

Detach ()

The same is the deletion of the current element, but the bound event still exists

Empty ()

Empties the current element, the text content and descendant elements of the element are deleted, but retains its own

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.