wrap() seems to clone the markup of the provided element to wrap, rather than the actual element itself. You can see it in the developer tools when you use console.log($testWrapper) and hover over this line in the browser console: usually the DOM element should be selected, but it is not. So what the $testWrapper variable refers to after completion is still (jQuery collection) a node that is not bound to the DOM.
var $test = $('.test'), $test1 = $('.test1'), $move = $('.move'), $testWrapper = $('<div class="test-wrapper"></div>'); $test.wrap($testWrapper);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="test">test</div> <div class="move"></div>
source share