jQuery DOM operation wrapAll()

Wrap is for a single DOM element. If you want to wrap the elements in the collection with other elements, that is, add a parent element to them. For such processing, JQuery provides a wrapAll method

wrapAll(wrappingElement): Add an outer wrapping HTML structure to the matching elements in the collection

Let’s write an example

Look at the following code:

    wrapALL  

php 中文网

php.cn

The above code, You can debug locally and press F12 to view. We can see that two p tags are wrapped by a div tag

Continuing Learning
||
wrapALL

php 中文网

php.cn

submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!