Wrapping multiple images inside a <div> in jQuery
        Posted  
        
            by alekone
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by alekone
        
        
        
        Published on 2010-03-23T09:13:55Z
        Indexed on 
            2010/03/23
            9:23 UTC
        
        
        Read the original article
        Hit count: 227
        
hello! I need to find all the images inside a div, and wrap a div around them. here's the code I come up with, but that's not working! any ideas? thanks!
    jQuery(function(){
 my_selection = [];
 $('.post').each(function(i){
  if ($(this).find('img').length > 1 ){
   my_selection.push(['.post:eq(' + i + ')']);
  }
 });
 $( my_selection.join(',')).wrapAll('<div class="wrapper"></div>');
});
© Stack Overflow or respective owner