The jQuery wrap() method does not wrap using element you created, but a duplicate:
var $orig = $('p'); // some existing element
var $wrap = $('<div>').css({border:'1px solid red'});
$orig.wrap($wrap);
$wrap.append('<p>SMOKE YOU</p>'); // does not appear after the original element
If you are not convinced, you can see a live version of the above here: http://jsfiddle.net/QRmY6/
How do I best create non-trivial dynamic content to wrap around an existing node while retaining a reference to the wrapper that ends up around the content?
The best alternatives I have come up with are: