When I read tonight, I found out that jquery has three package nodes, and Baidu has a bit of jquery wrap ()/Wrapall ()/Wrapinner (), and sure enough the search results W3school document description is the first.
However, W3school's explanation is this:
JQuery Document Manipulation-wrap () method
The Wrap () method places each selected element in the specified HTML content or element.
JQuery Document Manipulation-Wrapall () method
Wrapall () places all the selected elements in the specified HTML content or element.
JQuery Document Manipulation-Wrapinner () method
The Wrapinner () method wraps all content (inner HTML) in each selected element using the specified HTML content or element.
I read fewer books, and it was annoying to see such an explanation not to solve my confusion immediately.
or the most practical.
This is used to compare the original code:
<p> I am a seat. </p>
<p> I am a seat. </p>
Wrap () method
$ ("P"). Wrap ("<strong></strong>");
Results:
You can see from the diagram that the strong tag encloses each matching p tag.
Wrapall () method
$ ("P"). Wrapall ("<strong></strong>");
Results:
As you can see from the diagram, the strong tag encloses all of the matching P tags all of a sudden.
Wrapinner () method
$ ("P"). Wrapinner ("<strong></strong>");
Results:
You can see from the diagram that the strong tag is embedded inside each matching p tag.
Of course, at last it looks like the effect of three methods is the same.
Point to stop.
That is the difference between the individual and The Wrap () Wrapall () and Wrapinner () in jquery, just a personal understanding of the great God please skip.