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.效果