Skip to content
Related Articles

Related Articles

Improve Article

HTML | DOM Table deleteCaption() Method

  • Last Updated : 19 Feb, 2019

The Table deleteCaption() method is used for deleting a <caption> element and removing its content from the table.
It can be only used if a <caption> element already exists.



Below program illustrates the Table deleteCaption() method :
Example: Deleting a <caption> element.

<!DOCTYPE html>
    <title>Table deleteCaption() Method in HTML
        td {
            border: 1px solid green;
        h1 {
            color: green;
        h2 {
            font-family: Impact;
        body {
            text-align: center;
    <h2>Table deleteCaption() Method</h2>
    <p>To create a Caption for the table, 
      double-click the "Add Caption" button.</p>
    <p>To delete a Caption from the table, 
      double-click the "Delete Caption" button.</p>
    <table id="Courses" 
            <td>Fork Java</td>
            <td>Fork Python</td>
            <td>Sudo Placement</td>
    <button ondblclick="Add_Caption()">
      Add Caption
    <button ondblclick="Delete_Caption()">
      Delete Caption
        function Add_Caption() {
            //  Create caption.
            var MyTable = 
            MyTable.innerHTML = 
        function Delete_Caption() {
           // Delete caption.


  • Before clicking the “Add Caption” button:
  • After clicking the “Add Caption” button:
  • After clicking the “Delete Caption” button:

Supported Browsers:

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

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :