Home > Web Front-end > JS Tutorial > body text

Usage examples of wrapAll() method in jQuery_jquery

WBOY
Release: 2016-05-16 16:19:52
Original
965 people have browsed it

The example in this article describes the usage of wrapAll() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:

This method wraps all matching elements in a single element.
Although this method has similar functions to the wrap() method, it is very different. The wrap() method will match each matching element once.

Grammar 1:

Wrap matching elements with specified DOM elements.

Copy code The code is as follows:
$(selector).wrapAll(elem)

Parameter list:
参数 描述
elem 用于包裹目标的DOM元素。

实例:

复制代码 代码如下:






脚本之家





   

我是个段落


   

我是个段落


   

   


语法二:

用html标记代码包裹匹配的元素。

复制代码 代码如下:
$(selector).wrapAll(html)

参数列表:
参数 描述
elem 用于包裹目标的DOM元素。

实例:

复制代码 代码如下:






脚本之家





  

这是个段落


  

这是个段落


  


希望本文所述对大家的jQuery程序设计有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!