1.测试代码

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<style>
  body { font-size:16px; font-weight:bolder; }
  p { margin:5px 0; }
</style>
</head>
<body>
  <div>
    <span>Hello</span>
    <p class="selected">Hello Again</p>
    <div class="selected">And Again</div>

    <p>And One Last Time</p>
  </div>
<script>$("div").children(".selected").css("color", "blue");</script>
</body>
</html>

 

2.效果图

jquery children()方法

 

相关文章:

  • 2021-05-24
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-03
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案