Home >Web Front-end >Front-end Q&A >DOM operation in JQuery - wrap
wrap: wrap, the usage is $(a).wrap((b)); Wrap a with b (each element will be wrapped)
For example: in body There are three p
<p>p1</p> <p>p2</p> <p>p3</p>
Now perform the wrapping operation on p:
$("p").wrap("<p></p>");
The corresponding output is
unwrap: Unwrap
For example, now unwrap the three p’s above:
$("p").unwrap();
wrapAll: All elements are wrapped (all elements will be wrapped together)
For example: perform wrapAll operation on the above three p
$("p").wrapAll("<p></p>");
The output is:
wrapInner: inner wrap
This is to rebuild a new element at the next level inside the element and put all the contents of the parent element Wrap; look directly at the example:
Now there is a p with content and elements inside;
<p>p1 <a href="" title="">连接</a></p>
We perform wrapInner operations on it:
$("p").wrapInner('<p></p>');
The output is:
django uses request to obtain the parameters sent by the browser
Some thoughts on React this binding
The problem of passing value from parent component to child component echarts in vue
The above is the detailed content of DOM operation in JQuery - wrap. For more information, please follow other related articles on the PHP Chinese website!