jquery子元素过滤选择器,
来源:互联网 发布:2016年速卖通销售数据 编辑:程序博客网 时间:2024/05/21 19:31
1.1. 子元素过滤选择器
根据子元素顺序来获取。
:nth-child(序号);根据序号来选择,序号是从1开始,也可以设置odd even 根据奇偶来设置
也可以通过倍数(例如3n+1)来设置
:first-child(); 获取第一个
:last-child(); 获取最后一个
:only-child(); 获取只有一个子元素的元素
示例:
$(function() {
//设置列表中第2个li字号为30
$("ul li:nth-child(2)").css("font-size",40)
//设置列表中第一行字体为红色 first-child 匹配第一个子元素
$("ul li:first-child").css("color","red");
//设置列表中最后一行字体为蓝色last-child 匹配最后一个子元素
$("ul li:last-child").css("color","blue");
//获取ul下只有一个li的信息only-child 匹配是唯一子元素的元素
alert($("ul li:only-child").html());
});
阅读全文
0 0
- jquery子元素过滤选择器
- jquery子元素过滤选择器
- jquery子元素过滤选择器
- jQuery子元素过滤选择器
- jQuery-子元素过滤选择器
- jquery子元素过滤选择器,
- jquery子元素过滤选择器
- JQuery选择器(9子元素过滤选择器)
- jQuery选择器 过滤选择器(五.子元素过滤选择器)
- jQuery过滤选择器——子元素过滤选择器
- 一步一步学习 JQuery (四) 过滤选择器:属性过滤选择器 && 子元素过滤选择器 && 表单过滤选择器
- jQuery(2-7)子元素过滤选择器
- jquery中的子元素过滤选择器
- jQuery 的子元素过滤选择器
- 【jQuery】:first-child子元素过滤选择器
- 【jQuery】:last-child子元素过滤选择器
- 【JQuery】:first-child子元素过滤选择器
- jQuery的子元素过滤选择器
- APIC (Advanced Programmable Interrupt Controller高级可编程中断控制器)
- gcc编译选项说明
- 关于winfrom界面加载的学习和思考
- JS 中的require 和 import 区别
- 电脑更改用户名字
- jquery子元素过滤选择器,
- 获取access_token报错"errcode": 40125,"errmsg": "invalid appsecret, view more at http://t.cn/RAEkdV
- 不在以下 request 合法域名列表中,请参考文档:https://mp.weixin.qq.com/debug/wxadoc/dev/api/
- andorid-studio 底部sliderbar 的message等不显示的问题
- [App] Nginx 通过 https 方式访问
- Jenkins和cruisecontrol都是CI工具
- hdu4393 Throw nails【优先队列&&贪心&&模拟】
- android:text 与tools:text
- 【noi2001】方程的解数