jquery next()方法

1.html代码

<!DOCTYPE html>
<html>
<head>
  <script type="text/javascript" src="/jquery/jquery.js"></script>
</head>

<body>
<ul>
   <li>list item 1</li>
   <li>list item 2</li>
   <li class="third-item">list item 3</li>
   <li>list item 5</li>
   <li>list item 4</li>
</ul>

<script>
$('li.third-item').next().css('background-color', 'red');
</script>

</body>
</html>

 

2.效果

  

 

posted @ 2017-03-04 15:28  Mr_伍先生  阅读(1288)  评论(0编辑  收藏  举报