Using jQuery, in Firebug, if the following is done one by one:
foo = $('<div>foo</div>')
foo[0] // => <div>
foo.html('<span>bar</span>')
foo.html() // => "<span>bar</span>"
foo[0] // => <div>
$('body').prepend(foo) // => shows bar at top of page
it is strange that foo.html() shows the span, but foo[0] shows the div... why is the inconsistency? It seems that foo became a jQuery wrapper for a span element. Shouldn't foo[0] show the span also?