内容选择器


[color=red][size=x-large]内容选择器[/size][/color]
<script type="text/javascript" src="jquery-1.4.3.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#button1").click(function()
{
//匹配包含给定文本的元素.
//查找所有包含 "test" 的 div 元素
$("div:contains('test')").css("background","red");
});

$("#button2").click(function()
{
//匹配所有不包含子元素或者文本的空元素
//查找所有不包含子元素或者文本的空元素
$("div:empty").css("background","blue");
});

$("#button3").click(function()
{
//匹配含有选择器所匹配的元素的元素
//给所有包含class="mini" 元素的 div 元素添加background
$("div:has('.mini')").css("background","red");
});

$("#button4").click(function()
{
//匹配含有子元素或者文本的元素
//查找所有含有子元素或者文本的 td 元素
$("div:parent").css("background","yellow");
});

$("#button5").click(function()
{
//查找隐藏的 tr
//alert($("div:hidden").length);
$("div:hidden").show(3000).css("background","orange");
});

$("#button6").click(function()
{
//查找所有可见的 tr 元素
//alert($("div:hidden").length);
$("div:visible").show(3000).css("background","orange");
});

});
</script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值