Style Odd or Even DIV Using jQuery

Style Odd or Even DIV Using jQuery


DIV 1
DIV 2
DIV 3
DIV 4
DIV 5
DIV 6
DIV 7
DIV 8
DIV 9
DIV 10

Below is the script that is used to generate above functionality.
     //START     
     $(document).ready(function(){
         $("#resetODD").click(function() {
             $(".oddDiv").css("color", "lime");
             $(".oddDiv").css("background-color", "teal");
         });
         $('#resetEVEN').click(function() {
             $('.evenDiv').css('color', 'red');
             $('.evenDiv').css('background-color', 'blue');
         });
         $('#resetALL').click(function() {
             $('.oddDiv').css('color', 'white');
             $('.oddDiv').css('background-color', "black");
             $('.evenDiv').css("color", 'white');
             $('.evenDiv').css("background-color", "black");
         });
     });
     //END

No comments:

Post a Comment

Grab The Button...

Grab the above button and add to your blog or website to get easy access to Virtual Species. Simply click the textbox, copy the code and paste where you want to see the button. That's it!

About Author...

My photo

Technophile and believer of 'Be the Change to Change the World' _(Try to ♲)