jQuery 遍历 - eq() 和siblings() 方法
来源:互联网 发布:成品app直播源码 编辑:程序博客网 时间:2024/04/29 20:28
eq() 方法将匹配元素集缩减值指定 index 上的一个。
通过为 index 为 2 的 div 添加适当的类,将其变为蓝色:
<!DOCTYPE html><html><head> <style> div { width:60px; height:60px; margin:10px; float:left; border:2px solid blue; } .blue { background:blue; } </style> <script type="text/javascript" src="/jquery/jquery.js"></script></head><body> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <script>$("body").find("div").eq(2).addClass("blue");</script></body></html>
siblings()查找每个 p 元素的所有类名为 "selected" 的所有同胞元素:
<!DOCTYPE html><html><head> <script type="text/javascript" src="/jquery/jquery.js"></script></head><body> <div><span>Hello</span></div> <p class="selected">Hello Again</p> <p>And Again</p><script>$("p").siblings(".selected").css("background", "yellow");</script></body></html>
0 0
- jQuery 遍历 - eq() 和siblings() 方法
- jQuery 遍历 - siblings() 方法
- jQuery 遍历 - siblings() 方法
- jQuery 遍历 - siblings() 方法
- jQuery 遍历 中 eq() 方法
- eq(n)、siblings()方法总结
- jQuery 中的 siblings 、eq、off、index、delegate
- jquery遍历函数siblings()
- jquery遍历函数siblings()
- jquery遍历函数siblings()
- jquery遍历-siblings()
- jQuery 遍历 - 同胞(siblings)
- jQuery遍历之siblings()
- jQuery基础教程之DOM操作-遍历节点-siblings()方法
- Jquery 之siblings()方法
- jQuery siblings() 方法
- eq() siblings()用法
- Jquery学习之siblings方法
- 泛型约束
- java面向对象(十) 继承性
- WAP校招笔试
- maven搭建 springmvc+mybatis应用
- VS2012 CRT函数安全错误(This function or variable may be unsafe)
- jQuery 遍历 - eq() 和siblings() 方法
- Java中 -1l<<<1是多少?
- OpenCV&Qt学习之一——打开图片文件并显示
- 【实验二】单链表的实验验证
- CentOS 安装xserver
- 乐观机制的并发控制
- 字符串查找问题
- 从C语言谈程序语言
- Codeforces Round #271 (Div. 2)