Home  >  Article  >  Web Front-end  >  jQuery中clone()方法用法实例_jquery

jQuery中clone()方法用法实例_jquery

WBOY
WBOYOriginal
2016-05-16 16:20:011021browse

本文实例讲述了jQuery中clone()方法用法。分享给大家供大家参考。具体分析如下:

此方法克隆匹配的DOM元素并且选中这些克隆的副本以及其所有的事件处理。

语法结构:

复制代码 代码如下:
$(selector).clone(Events,deepEvents)

参数列表:

参数 描述
Events 可选。布尔值,用来规定事件处理函数是否被复制。默认为false。
true-复制元素的所有事件处理。
false-不复制元素的事件处理。
deepEvents 可选。布尔值,用来规定是否对事件处理程序和克隆的元素的所有子元素的数据应该被复制。

实例代码:

复制代码 代码如下:






脚本之家





我是div

我会被克隆





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

本文转自:蚂蚁部落http://www.softwhy.com/

Statement:
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