All previous from a LI tag
<html> <head> <script type='text/javascript' src='js/jquery-1.3.2.js'></script> <script type='text/javascript'> var tmpExample = { ready : function() { $('li#liID').prevAll().addClass('mySiblings'); } }; $(document).ready(tmpExample.ready); </script> <style type='text/css'> ul#uiID { list-style: none; margin: 0; padding: 0; } ul#uiID li { margin: 1px; padding: 3px; } li.mySiblings { background: #165b91; color: white; } </style> </head> <body> <ul id='uiID'> <li>Red</li> <li>Blue</li> <li>Green</li> <li id='liID'>Yellow</li> <li>Orange</li> <li>Purple</li> </ul> </body> </html>