Revision: 41751
                            
                                                            
                                    
                                        
Updated Code
                                    
                                    
                                                    
                        at April 16, 2011 02:04 by pedromagalhaes
                            
                            Updated Code
$(document).ready(function(){                               
    function getChild($class,$pos,$add,$clear,$separator){
        $num_divs = $($class).length;
        $i = 1;
        for($i; $i <= $num_divs; $i++){
            if($i % $pos == 0){
                $($class).eq($i-1).addClass($add);
				if($clear == 1){
					$('<div class="clear"></div>').insertAfter($($class).eq($i-1));
				}
				if($separator == 1){
					$('<div class="separator"></div>').insertAfter($($class).eq($i-1));
				}				
            }
        }
    }    
    getChild('.div ul li',4,'newclass',1,1);
});
                                
                            Revision: 41750
                            
                                                            
                                    
                                        
Updated Code
                                    
                                    
                                                    
                        at February 23, 2011 03:02 by pedromagalhaes
                            
                            Updated Code
$(document).ready(function(){                               
    function getChild($class,$pos,$add,$clear,$separator){
        $num_divs = $class.length;
        $i = 1;
        for($i; $i <= $num_divs; $i++){
            if($i % $pos == 0){
                $($class).eq($i-1).addClass($add);
				if($clear == 1){
					$('<div class="clear"></div>').insertAfter($($class).eq($i-1));
				}
				if($separator == 1){
					$('<div class="separator"></div>').insertAfter($($class).eq($i-1));
				}				
            }
        }
    }    
    getChild('.div ul li',4,'newclass',1,1);
});
                                
                            Revision: 41749
                            
                                                            
                                    
                                        
Updated Code
                                    
                                    
                                                    
                        at February 23, 2011 03:01 by pedromagalhaes
                            
                            Updated Code
$(document).ready(function(){                               
    function getChild($class,$pos,$add,$clear,$separator){
        $num_divs = $class.length;
        $i = 1;
        for($i; $i <= $num_divs; $i++){
            if($i % $pos == 0){
                $($class).eq($i-1).addClass($add);
				if($clear == 1){
					$('<div class="clear"></div>').insertAfter($($class).eq($i-1));
				}
				if($separator == 1){
					$('<div class="separator"></div>').insertAfter($($class).eq($i-1));
				}				
            }
        }
    }    
    getChild('.div ul li',4,'newclass',1,1);
    // this means: get the li's, and on every four elements add "newclass", plus, i want a ".clear" and ".seperator" div (to clear the floats and style the separator properly)
});
                                
                            Revision: 41748
                            
                                                            
                                    
                                        
Updated Code
                                    
                                    
                                                    
                        at February 23, 2011 03:00 by pedromagalhaes
                            
                            Updated Code
$(document).ready(function(){                               
    function getChild($class,$pos,$add,$clear,$separator){
        $num_divs = $class.length;
        $i = 1;
        for($i; $i <= $num_divs; $i++){
            if($i % $pos == 0){
                $($class).eq($i-1).addClass($add);
				if($clear == 1){
					$('<div class="clear"></div>').insertAfter($($class).eq($i-1));
				}
				if($separator == 1){
					$('<div class="separator"></div>').insertAfter($($class).eq($i-1));
				}				
            }
        }
    }    
    getChild('.div ul li',4,'newclass',1,1);
    // this means: get the li's, and on every four elements add a newclass, plus, i want a .clear and .seperator div to clear the floats and style the seperator
});
                                
                            Revision: 41747
                            
                                                            
                                    
                                        
Initial Code
                                    
                                    
                                                            
                                    
                                        
Initial URL
                                    
                                    
                                
                                                            
                                    
                                        
Initial Description
                                    
                                    
                                                            
                                    
                                        
Initial Title
                                    
                                    
                                                            
                                    
                                        
Initial Tags
                                    
                                    
                                
                                                            
                                    
                                        
Initial Language
                                    
                                    
                                                    
                        at February 23, 2011 02:53 by pedromagalhaes
                            
                            Initial Code
$(document).ready(function(){                               
    function getChild($class,$pos,$add,$clear,$separator){
        $num_divs = $class.length;
        $i = 1;
        for($i; $i <= $num_divs; $i++){
            if($i % $pos == 0){
                $($class).eq($i-1).addClass($add);
				if($clear == 1){
					$('<div class="clear"></div>').insertAfter($($class).eq($i-1));
				}
				if($separator == 1){
					$('<div class="separator"></div>').insertAfter($($class).eq($i-1));
				}				
            }
        }
    }    
    getChild('.div.ul li',4,'newclass',1,1);
    // this means: get the li's, and on every four elements add a newclass, plus, i want a .clear and .seperator div to clear the floats and style the seperator
});
                                Initial URL
Initial Description
Call the function like this:
getChild('.div ul li',4,'newclass',1,1);
Explain: Get all the li's, on every 4 add "newclass", plus, i want a ".clear" and ".seperator" div (to clear the floats and style the separator properly)
                                Initial Title
Style elements, give classes, clear floats and add separators (for rows and columns)
Initial Tags
Initial Language
jQuery