What is wrapAll in jQuery

Include elements of JQuery dry goods

The HTML and CSS used this time are still the source code of my last article, see previous article

classification

  1. Insert child elements :, ,,
  2. Package elements: ,,
  3. Insert sibling elements: ,,,
  4. Replace elements :,
  5. Delete element: ,,,

Create new item

Usually inserting new elements inBefore reaching the target position, you must create a new element before inserting it in the specified position

use create element

clone

To clone the element, use the method uses the existing element as a model to generate a new element that will play a key role in the element inserted later. If you want to refer to a tag content in HTML, don't use method, then this content will be moved, so here we use it will be very convenient, please see examples of use for details

Examples:

Create new elements with the DOM API

In use Actually ready for operation Call quietly behind the scenes

Examples:

append

Insert the element specified by the parameter into allThe end of the contents of the contained elements becomes their last child element in the form ,,,

Examples:

prepend

with Insert completely opposite at the front of the current element The node is a child element of the current element in the form ,,,

Examples:

appendTo

yes andThe same function inserts the specified element as a child before the specified element, but its parameters are different. Is inserting the specified parameters into the result set of the current call, andTo insert the result set of the current call into the specified parameters are the main forms ,

Examples:

prependTo

To achieve the same function, the main difference is in the syntax, the content inserted, and the target location. In other words, the selector expression is written before the method as a container for the content to be inserted, and the content to be inserted is used as the method parameter. While, on the contrary, write the content to be inserted before the method, which can be a selector expression or a dynamically created marker, using the container of the content to be inserted as a parameter.

nach

Add the content specified by the parameter after each element in the group of matching elements as sibling nodes. In the form, Here, the content contains HTML strings. Elements, text nodes, arrays of elements, and text nodes, or object that is used to insert after each matching element in the collection

Examples:

before

According to the parameter setting, paste the content, the form, and the same, the content is similar

insertBefore

Usage is similar, except that the parameter is the target position to be inserted, which is inserted as a sibling element

Examples:

insertAfter

The usage is similar, but the parameter is the target position to be inserted, here it is also inserted as a sibling element

Examples:

wrap

Wrap one around each item that matches in the set, the structure will be present as the parent. The shape is ,,,

Examples:

unwrap

Delete the parent of the group of matching elements and leave them (and sibling elements, if any) in their original positions. The shape is

Examples:

wrapAll

Wrap an HTML structure outside of any matching elements in the set, that is, set all elements in the result set to the same parent to wrap all elements in the form.

Examples:

wrapInner

The content of the matching element is paged out by a structural level, i.e. a parent is added to the child of the matching element, but that parent is the child of the matching element, i.e. the originally matching element becomes the ancestor element. The shape is ,,,

Examples:

replaceWith

Replace any matching items in the set with the provided content and return the set of deleted items in the form,

Examples:

replaceAll

Replace each target element with the matching element of the set; the function is similar, but the target and source are opposite

Examples:

remove

Set matching items from Delete and also remove the event for the item and data

Examples:

detach

From Remove all matching elements in Methods and Equal, except save all, the data is associated with the removed element. This method is useful when you need to remove an item and soon need to add the item to the DOM.

Examples:

empty

Remove all child nodes of the matching item in the collection.

Reference article