Removes the set of matched elements from the DOM and all their children. selector filters the set of matched elements to be removed.
selector
Optional
Optional selector for elements to remove.
The instance itself.
$('.pear').remove();$.html();//=> <ul id="fruits">// <li class="apple">Apple</li>// <li class="orange">Orange</li>// </ul> Copy
$('.pear').remove();$.html();//=> <ul id="fruits">// <li class="apple">Apple</li>// <li class="orange">Orange</li>// </ul>
https://api.jquery.com/remove/
Removes the set of matched elements from the DOM and all their children.
selectorfilters the set of matched elements to be removed.