
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a table caption with JavaScript DOM?
To create a table caption, use the DOM createCaption() method.
Example
You can try to run the following code to learn how to create table caption −
<!DOCTYPE html> <html> <head> <script> function captionFunc(x) { document.getElementById(x).createCaption().innerHTML = "Demo Caption"; } </script> </head> <body> <table style="border:2px solid black" id="newtable"> <tr> <td>One</td> <td>Two</td> </tr> <tr> <td>Three</td> <td>Four</td> </tr> <tr> <td>Five</td> <td>Six</td> </tr> </table> <p> <input type="button" onclick="captionFunc('newtable')" value="Display Table Caption"> </p> </body> </html>
- Related Questions & Answers
- How to create a table with a caption?
- HTML DOM Table caption Property
- Create caption for a table in HTML?
- How to create a filter table with JavaScript?
- HTML DOM Caption Object
- How to set the position of the table caption in JavaScript?
- With JavaScript DOM delete rows in a table?
- How do we include a table caption in HTML?
- Control the placement of the table caption with CSS
- How to create a MySQL table with InnoDB engine table?
- How to create a MySQL table with MyISAM engine table?
- How to add rows to a table using JavaScript DOM?
- How to create a table with date column?
- How to create a MySQL table with indexes?
- How to create a responsive table with CSS?
Advertisements