小白教程
所有教程
关于
Search
172.70.131.144
172.70.131.144
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Misc pushstack”的源代码
本页内容
上一节:
Misc_toarray
下一节:
Misc_when
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:pushStack()}}[[Category:jquery ref misc|10]] = jQuery pushStack()方法 = [[jquery ref misc|jQuery 杂项方法]] 向 jQuery 栈中先压入一些元素,然后再删除它们,之后再退回到之前刚压入栈的状态。 <sample title="" desc="" lang="html" hererun="1"> <div></div> <script> $(function () { $().pushStack( document.getElementsByTagName("div")).remove().end(); }) </script> </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script> <style> div { border:1px solid #cccccc; width:20px; height:20px; } </style> </head> <body> <div></div> <script> $(function () { $().pushStack( document.getElementsByTagName("div")).remove().end(); }) </script> </body> </html> </run> == 定义和用法 == pushStack() 函数用于将一个DOM元素集合加入到jQuery栈。 == 语法 == 用法一 pushStack( elements, name, arguments ) {| class="table table-striped table-hover" ! 参数 ! 描述 |- | element | Array类型 将要压入 jQuery 栈的数组元素,用于生成一个新的 jQuery 对象 |- | name | 可选。 String类型 生成数组元素的 jQuery 方法名 |- | arguments | 可选。 Array类型 传递给 jQuery 方法的参数(用于序列化) |} [[jquery ref misc|jQuery 杂项方法]]
返回至“
Misc pushstack
”。
上一节:
Misc_toarray
下一节:
Misc_when