Using jquery:
1) Create a container
2) Wrap an element with it
3) Select container by passing an object to jquery selector and try to add an element to the container
Why doesn't element append?
Look at this example here: http://jsfiddle.net/Tngh4/
var container = document.createElement("div");
//Wrapping some random element with the container
$("#randomElem").wrap(container);
var elem = document.createElement("div");
//Selecting element this way and using append results in a strange bug
$(container).append(elem);
.wrap wraps the element with a copy of the passed in element, not the passed in element itself.
http://api.jquery.com/wrap
Here's your fiddle to use an alternative to
.wrap
http://jsfiddle.net/Tngh4/1/