There is no big difference between those functions except the syntax:
$(\'.target\').append(\'text\');
$(\'text\').appendTo(\'.target\');
A
It's mostly a matter of taste.
One situation where appendTo
is more convenient is when you have a reference to an element rather than a jQuery object, for example in the variable dest
:
$("").appendTo(dest);
To use the append
method you have to create a jQuery object for the element to be able to call it:
$(dest).append($(""));