编辑下面的代码:【加编码】
<html> <head> <script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("p").nextAll().css("background-color","yellow"); }); </script> </head> <body> <p>This is a p element.</p> <div>This is a div element (next sibling of p).</div> <p>This is a p element (next sibling of p).</p> <h4>This is a h4 element (next sibling of p).</h4> <h5>This is a h5 element (next sibling of p).</h5> <p>This is a p element (next sibling of p).</p> <span>This is a span element (next sibling of p).</span> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂