Difference between appending to a jquery-wrapped object and appending using an ID selector

Difference between appending to a jquery-wrapped object and appending using an ID selector

Hi there,

I'm using jquery-1.10.1 and relatively new to web frontend development.
My question is as follows: is there a difference between wrapping a div element in a jquery object  then appending to that object, and directly appending to the div using the selector  $('#div_id').append() ?

I have a jquery widget that behaves differently depending on whether I'm passing around a div wrapped in a jquery object, or appending to div via selector.

In the first instance I have this:

div.append(content);

And secondly..

$('#div_id').append( content );

The latter always works however the former does not seem to push changes through to the screen, even though its innerHtml property is updated.

Any advice would be much appreciated..