class method Element.remove

View source on GitHub →

Element.remove(element) → Element

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>

And the associated JavaScript:

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

The resulting HTML:

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

This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.