2.2.1 包含选择器

2.2.1 包含选择器

:first  匹配找到的一个元素,例如$("tr:first")表示匹配表格的第1行


2.3.1  特定位置选择器

特定位置选择器主要包括:first,:last和eq(index)3种。
<script src="jquery-1.6.4.js" type="text/javascript"></script>

<table>
<tr><th>选择器1</th><th>说明1</th></tr>
<tr><th>选择器2</th><th>说明2</th></tr>
<tr><th>选择器3</th><th>说明3</th></tr>
<tr><th>选择器4</th><th>说明4</th></tr>
</table>

$(function(){

$("tr:even").css("color","red")

})
</script>



2.3.2 指定范围选择器 :

node2:/var/www/html#cat m21.html 
<script src="jquery-1.6.4.js" type="text/javascript"></script>

<table>
<tr><th>选择器1</th><th>说明1</th></tr>
<tr><th>选择器2</th><th>说明2</th></tr>
<tr><th>选择器3</th><th>说明3</th></tr>
<tr><th>选择器4</th><th>说明4</th></tr>
</table>
<script>
$(function(){

$("tr:not(tr:first)").css("color","red")

})
</script>
发布了3754 篇原创文章 · 获赞 112 · 访问量 346万+

猜你喜欢

转载自blog.csdn.net/zhaoyangjian724/article/details/103876509
今日推荐