代码示例如何设置背景色(background)
<html> <head> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("div").prevAll().css("background", "yellow"); }); </script> </head> <body> <div>findsrc.com</div> <div>findsrc.com</div> <div>findsrc.com</div> <div class="selected">findsrc.com</div> <div>findsrc.com</div> </body> </html>