I have a product listing like this :
<div class="listing">
.....</div>

I want to add different background color for the odd and even  listing
like so:

<div class="listing odd">
.....</div>

<div class="listing even">
.....</div>

<div class="listing odd">
.....</div>


I know how to use the simple addClass function in jQuery, but I am
unable to figure how to add the 'even' class. This is my code, can you
please tell me what I did wrong?

 <script>
        var $j = jQuery.noConflict();
        $j(document).ready(function() {
         $j("div.listing-item").addClass("odd") {
         $j(this).parent("div.listing-
item").next().siblings("odd").addClass("even"); ;

    });

 </script>

Many thanks!


Reply via email to