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);
}
});
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
Responsive Web Design
Ethan Marcotte / Happy Cog / 2011-6 / USD 18.00
From mobile browsers to netbooks and tablets, users are visiting your sites from an increasing array of devices and browsers. Are your designs ready? Learn how to think beyond the desktop and craft be......一起来看看 《Responsive Web Design》 这本书的介绍吧!