<body>
<h3>使用each()方法遍历元素</h3>
<span class="green">香蕉</span>
<span class="green">桃子</span>
<span class="green">葡萄</span>
<span class="green">荔枝</span>
<script type="text/javascript">
$("span").each(function (index) {
if (index == 1) {
$(this).attr("class", "red");
}
});
</script>
</body>
each这种遍历函数时怎样传参的,在调用过程中并没有赋值给形参,还有其他类似的有参函数传参问题???卡在这好久了,一致没搞明白
相关分类