Create a deep copy of the set of matched elements.
// <div class="original">Hi</div>
const $clone = $('.original').clone();
$clone.addClass('copy').appendTo('body');
<div class="original">Hi</div>
<div class="original copy">Hi</div>
const $smartClone = $('.btn').clone(true);
// Returns a new SR object with elements that have
// the same event listeners as the original .btn elements.
| Parameter | Type | Description |
|---|---|---|
| withDataAndEvents | boolean | Optional. If true, copies event handlers and data for the element itself. Default: false. |
| deepWithDataAndEvents | boolean | Optional. If true, copies event handlers and data for all children of the cloned element. Defaults to the value of the first argument. |
Returns: A new SR object containing the cloned elements.