jQuery.children()方法在jQuery中做什么?
如果要返回所选元素的所有直接子代,请使用jQuery.children()方法,
示例
您可以尝试运行以下代码,以了解如何在jQuery中使用jQuery.children()方法,
<!DOCTYPE html>
<html>
<head>
<style>
.myclass * {
display: block;
border: 2px solid blue;
color: black;
padding: 3px;
margin: 10px;
}
</style>
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("ol").children().css({"color": "red", "border": "5px solid red"});
});
</script>
</head>
<body class="myclass">body
<div style="width:600px;">div
<ol>ol
<li>li - This is the child
<span>span</span>
</li>
</ol>
</div>
</body>
</html>热门推荐
1 狗狗技能训练
5 如何训练狗狗笑
6 狗狗训练排便
9 狗狗响片训练
10 如何训练狗狗不捡食
11 狗狗尿训练
12 怎么训练狗狗找东西
13 狗狗训练站立
14 狗狗训练飞盘
15 鞍山狗狗训练
16 怎样训练泰迪狗狗谢谢
17 狗狗外出训练
18 怎么训练金毛狗狗大小便