Remove an element
1. Use the remove method
Note that the remove
method isn't supported in Internet Explorer.
ele.remove();
2. Use the removeChild method
if (ele.parentNode) {
ele.parentNode.removeChild(ele);
}
See also
- Calculate the size of scrollbar
- Copy text to the clipboard
- Download a file
- Drag and drop element in a list
- Drag and drop table column
- Drag and drop table row
- Measure the width of given text of given font
- Print an image
- Remove all children of a node
- Show a ghost element when dragging an element
- Show a loading indicator when an iframe is being loaded
- Sort a table by clicking its headers