The HTMLTableElement.deleteCaption()
method removes the <caption>
element from a given <table>
. If there is no <caption>
element associated with the table, this method does nothing.
Syntax
HTMLTableElement.deleteCaption()
Example
This example uses JavaScript to delete a table's caption.
HTML
<table> <caption>This caption will be deleted!</caption> <tr><td>Cell 1.1</td><td>Cell 1.2</td></tr> <tr><td>Cell 2.1</td><td>Cell 2.2</td></tr> </table>
JavaScript
let table = document.querySelector('table'); table.deleteCaption();
Result
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'HTMLTableElement: deleteCaption' in that specification. |
Living Standard |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
deleteCaption | Chrome Full support Yes | Edge Full support 12 | Firefox Full support Yes | IE Full support Yes | Opera Full support Yes | Safari Full support Yes | WebView Android Full support Yes | Chrome Android ? | Firefox Android Full support Yes | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android ? |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown