← Back to Index

.appendTo()

Insert every element in the set of matched elements to the end of the target.

Examples

1. Create and Append

$.t('<div>', { text: 'Hello' }).appendTo('body');

Result

<body>
     ...
     <div>Hello</div>
</body>

2. Move existing elements

$('.items').appendTo('#archive');

Result

<div id="archive">
     <!-- existing content -->
     <div class="items">...</div>
     <div class="items">...</div>
</div>

Parameters

Parameter Type Description
target string | element | SR A selector, element, or SR object. The matched elements will be inserted at the end of this target.

Returns: A new SR object containing all inserted elements (including clones and originals).