Latest web development tutorials

HTML DOM Table deleteCaption () method

Table Object Reference Table Object

Definition and Usage

deleteCaption () method is used to delete a table caption element and its contents.

Tip: Create anew title in the table use createCaption () method.

grammar

tableObject.deleteCaption()


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support deleteCaption () method


Examples

Examples

The following example deletes the table headings:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
    document.getElementById("myTable").deleteCaption();
}
</script>
</head>
<body>

<table id="myTable" border="1">
<caption>这是个表格标题</caption>
    <tr>
        <td>cell 1</td>
        <td>cell 2</td>
    </tr>
    <tr>
        <td>cell 3</td>
        <td>cell 4</td>
    </tr>
</table>
<br>
<button type="button" onclick="displayResult()">删除标题</button>

</body>
</html>

try it"


Table Object Reference Table Object