jQuery 杂项 toArray() 方法

jQuery 教程 · 2019-03-28 20:38:43

实例

把 <li> 元素转换为数组,然后输出该数组元素的 innerHTML :

$("button").click(function(){
x=$("li").toArray()
for (i=0;i<x.length;i++)
{
alert(x[i].innerHTML);
}
});

定义和用法

toArray() 方法以数组的形式返回 jQuery 选择器匹配的元素。

语法

$(selector).toArray()

点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html

查看所有标签

Pro Git (Second Edition)

Pro Git (Second Edition)

Scott Chacon、Ben Straub / Apress / 2014-11-9 / USD 59.99

Scott Chacon is a cofounder and the CIO of GitHub and is also the maintainer of the Git homepage ( git-scm.com ) . Scott has presented at dozens of conferences around the world on Git, GitHub and the ......一起来看看 《Pro Git (Second Edition)》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具