JavaScript table object method: deleteCaption()
[this page | pdf | back links]
The deleteCaption() method of the JavaScript
DOM object
corresponding to the HTML <table> element
removes the first <caption>
element from the table.
It has the following
syntax with no parameters:
object.deleteCaption()
EXAMPLE:
HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
table,td,tr,caption {border: thin solid black; border-collapse: collapse;}
</style>
</head>
<body>
<span id="element"></span>
<script>
var x = document.createElement("TABLE");
x.createCaption().innerHTML="A table";
var y0 = x.insertRow(0);
var y00 = y0.insertCell(0);
y00.innerHTML = "col1";
y00.style.color = "blue";
var y01 = y0.insertCell(1);
y01.innerHTML = "col2";
y01.style.color = "blue";
x.deleteCaption()
document.getElementById("element").appendChild(x);
</script>
</body>
</html>
|
FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedJavaScriptMethodTableDeleteCaption() {
var z = document.createElement("TABLE"); return !!z.caption;
} |
NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)