remove

remove(element) -> HTMLElement

Completely removes element from the document and returns it.

If you would rather just hide the element and keep it around for further use, try Element.hide instead.

Examples


// Before:
<ul>
  <li id="golden-delicious">Golden Delicious</li>
  <li id="mutsu">Mutsu</li>
  <li id="mcintosh">McIntosh</li>
  <li id="ida-red">Ida Red</li>
</ul>

$('mutsu').remove();
// -> HTMLElement (and removes li#mutsu)

// After:
<ul>
  <li id="golden-delicious">Golden Delicious</li>
  <li id="mcintosh">McIntosh</li>
  <li id="ida-red">Ida Red</li>
</ul>