Use each function to add class
<html> <head> <script type='text/javascript' src='js/jquery-1.3.2.js'></script> <script type='text/javascript'> $(document).ready( function() { $('li').each( function() { $(this).addClass('my'); } ); } ); </script> <style type='text/css'> ul { list-style: none; margin: 5px; padding: 0; } li.my { background: #a0cde5; border: 4px solid #99c6dd; } </style> </head> <body> <ul> <li>A</li> <li>B</li> <li>C</li> <li>D</li> </ul> </body> </html>