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


  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


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


Create new elements with the DOM API

In use Actually ready for operation Call quietly behind the scenes



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 ,,,



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



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 ,



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.


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



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


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



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



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



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



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.



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 ,,,



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



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



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



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.



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

Reference article