Return to Snippet

Revision: 11912
at February 23, 2009 13:11 by zachharkey


Updated Code
$(document).ready(function() {

    // Take all divs that match class .admin-links and move them inside of 
    // the next adjacent sibling div with class .block.
    var $blocks = $(".block");
    $blocks.each(function() {
      var $block = $(this);
      var $admin = $(this).prev();

      if (!$admin.hasClass("admin-links"))
        return $block;

      var $copy = $admin.clone(true);
      $admin.remove();
      $copy.prependTo($block);
    });  
});

Revision: 11911
at February 23, 2009 13:08 by zachharkey


Initial Code
    // Take all divs that match class .admin-links and move them inside of 
    // the next adjacent sibling div with class .block.
    var $blocks = $(".block");
    $blocks.each(function() {
      var $block = $(this);
      var $admin = $(this).prev();

      if (!$admin.hasClass("admin-links"))
        return $block;

      var $copy = $admin.clone(true);
      $admin.remove();
      $copy.prependTo($block);
    });  

Initial URL

                                

Initial Description
Thanks to [James](
http://www.girsbrain.org/blog
) for this code.

Initial Title
Move div.admin-links into the next adjacent sibling div.block

Initial Tags
textmate, jquery, drupal

Initial Language
JavaScript