Advertisement
monaliza86

Untitled

Feb 25th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "use strict";
  2. (function($) {
  3.     $.fn.myPlugin = function(options) {
  4.        
  5.         var o = $.extend ({
  6.             "header": "header",
  7.             "odd": "odd",
  8.             "even": "even"
  9.            
  10.         }, options);
  11.        
  12.         return this.each(function() {
  13.             var row= this.getElementsByTagName("tr");
  14.             for(var i=0;i<row.length;i++){
  15.                
  16.             if(i==0){
  17.                 row[i].setAttribute("class",o.header);}
  18.                
  19.            
  20.                
  21.                 if( i % 2 == 0 && i != 0){
  22.                 row[i].setAttribute("class",o.even);
  23.  
  24.            
  25.                 }
  26.                 else{
  27.                     if(i!=0){
  28.             row[i].setAttribute("class",o.odd);}
  29.                 }
  30.    
  31.             }
  32.    
  33.        
  34.         });
  35.     };
  36. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement