← Back to Index

.remove()

Remove the set of matched elements from the DOM.

Examples

1. Remove elements

// <div class="box">A</div><div class="box">B</div>
$('.box').remove();

Result

// Elements are removed from DOM.
// Returns SR object (now empty of elements)

Details

Also removes all event handlers and internal data associated with the matched elements and their descendants to prevent memory leaks.

Returns: The SR object (emptied of its internal element list).