您的位置:首页 > Web前端 > JQuery

jQuery选择器

2015-12-03 00:10 603 查看
//    基本选择器===================================
//    id选择器     $('#layer1').html('aaaa');
//    元素选择器     $('p').html('ppppp');
//    类选择器     $('.my_p').html('my_p');
//    并集选择器     $('#layer1,#layer2,#layer3').css('border',"1px solid red");
//    ==========================================================
//    层级选择器======================================================
//    后辈选择器     $('#Hierarchy div ul li.my_li').css('background',"#ccc");
//    直接子元素选择器     $('#Hierarchy>ul').css("background",'#ccc');
//    同级直接后一个元素     $('#Hierarchy div.div1 ul+p').css('background',"#ccc");
//    同级后面所有元素     $('#Hierarchy div.div1 ul~p').css('background',"#ccc");
//==============================================================================
//    过滤选择器 //    过滤出第一个     $('li:first,li:last').css('border','1px solid red');
//    排除过滤器     $('li:not(:first)').css('border','1px solid red');
//找出没有选中的checkbox     $('input:not(:checked)').attr('checked','true');
//    索引奇数偶数过滤器     $('table tr:odd').css('background','#ddd');
//    索引 大于小于过滤器     $('table tr:lt(2)').css('background','#ddd');
$('#basic').animate({         'width':'400px',         'height':'400px'     },1000);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: