How to delete caption of a table in JavaScript

In this article I have described about table deleteCaption() method used in JavaScript.
  • 1502

Table deleteCaption() method in JavaScript

  • As we know that a table object represents a table in HTML.
  • If want to delete the caption from table then we can use table deleteCaption() method

Browser support

Following are the main browsers which support the table deleteCaption() method

  • Internet Explorer.
  • Firefox.
  • Opera.
  • Google Chrome.
  • Safari.

Syntax

The syntax of table deleteCaption() method as follows

tableObject.deleteCaption()

Lets take an example

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript">

    function DELCPTION()

    {

        document.getElementById("Table").deleteCaption();

    }

</script>

</head>

<body style ="background-color:GREEN">

<table id="Table" border="1">

<caption>CAPTION OF THE FOLLOWING TABLE</caption>

  <tr>

    <td>WORLD</td>

    <td>COUNTORY</td>

  </tr>

  <tr>

    <td>STATE</td>

    <td>DISTRICT</td>

  </tr>

</table>

<br />

<button type="button" onclick="DELCPTION()">DELETE CAPTION</button>

</body>

</html>

 

Output


DELAPCTION1.jpg

 

when we click on button


DELCPTION2.jpg

 

Further Readings

You may also want to read these related articles :here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.