fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> <style> .siblings *{ display: block; border: 2px solid lightgrey; color: lightgrey; padding: 5px; margin: 15px; } </style> <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"> </script> <script> $(document).ready(function(){ $("li.start").siblings(".1").css({"color":"red","border":"2px solid red"}); }); </script> </head> <body> <div style="width:500px;" class="siblings"> <ul>ul (parent) <li>li (the previous sibling of "start")</li> <li class="1">li (the previous sibling of "start")</li> <li class="start">li (sibling)</li> <li>li (the next sibling of "start")</li> <li class="1">li (the next sibling of "start")</li> </ul> </div> <p>在这个例子中,我们缩小搜索结果只返回在类名为“star”和“stop”的li元素之间类名为“1”的兄弟元素。</p> </body> </html>
运行结果