<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
div{
padding: 5px;
margin-bottom: 2px;
background: rgba(0, 0, 0, 0.1)
}
</style>
<title>Document</title>
<script src="C:\Users\PC\Desktop\jquery-3.3.1.js"></script>
<script>
$(document).ready(function(){
$('.gf').find('.children').css('border','2px solid red');
$('#child2').parent().css('border','1px solid blue');
$('.children').parents('.gf').css('border','1px solid #999');
$('.children').filter('.not-gay').css('background','red');
});
</script>
</head>
<body>
<div class="gf">
<div class="fa">
<div class="children not-gay" id="child1" >ss</div>
<div class="children" id="child2">ss</div>
</div>
</div>
</body>
</html>
jquery--选择器与过滤器
最新推荐文章于 2020-06-15 10:28:24 发布