Insights & Ideas

Explore Toshal Infotech's latest insights on AI, software development, web technology, testing, and digital trends.

Quick jQuery based JS for alternate row styling to table

Setup jQuerify bookmarklet from http://www.learningjquery.com/2008/06/updated-jquery-bookmarklet

Once you have that just place following code in FireBug and you will see alternate style applied J

var itemIndex =0;

jQuery("tr").each(function(){

    itemIndex = itemIndex + 1;

    if( (itemIndex % 2) === 0){

        jQuery(this)

            .css("background", "#6b7fde")

            .css("color", "#fff");

    }

    return this;

})

.css("font-size", "12px")

.css("font-family", "verdana")

.attr("valign", "top");

jQuery("table").attr("cellpadding", "4");

 

Words from our clients

 

Tell Us About Your Project

We’ve done lot’s of work, Let’s Check some from here