Adds elements to the current set of matched elements.
const $set = $('div').add('p');
$set.css('border', '1px solid red');
<!-- matched elements -->
<div style="border: 1px solid red;">...</div>
<p style="border: 1px solid red;">...</p>
const $spans = $('span');
$('div').add($spans).addClass('highlight');
<div class="highlight"></div>
<span class="highlight"></span>
const $btn = $('#myBtn');
$('div').add($btn).hide();
<div style="display: none;"></div>
<button id="myBtn" style="display: none;">Click</button>
| Parameter | Type | Description |
|---|---|---|
| selector | string | element | SR | A string selector, a DOM element, or an SR object to add to the set. |
Returns: A new SR object containing the combined set.