jQuery 遍历 方法 第3页

jQuery each() 方法

阅读(357)

实例 Run this code » 输出每个 <li> 元素的文本: $("button").click(function(){ $("li").each(function(){ alert($(this).text()) }...

jQuery contents() 方法

阅读(373)

实例 Run this code » 查找 <div> 元素内所有的文本节点,并把它们用 <b> 元素包裹起来: $("div").contents().filter("em").wrap(""); 定义和用法 co...

jQuery closest() 方法

阅读(307)

实例 Run this code » 返回 <span> 的第一个祖先元素,是一个 <ul> 元素: $(document).ready(function(){ $("span").closest("ul").css...

jQuery children() 方法

阅读(343)

实例 Run this code » 返回 <ul> 的直接子元素: $(document).ready(function(){ $("ul").children().css({"color":"red","border":"2...

jQuery add() 方法

阅读(275)

实例 Run this code » 把 <p> 和 <span> 元素添加到已存在的元素组合中(<h1>): $("h1").add("p").add("span") 定义和用法 add() 方法把元素...