HTML DOM createComment() Method
❮ Document Object
Example
Create a comment node, and insert it to the HTML document:
var c = document.createComment("My personal comments");
document.body.appendChild(c);
Try it Yourself »
Definition and Usage
The createComment() method creates a Comment node with the specified text.
Browser Support
Method |
|
|
|
|
|
createComment() |
Yes |
Yes |
Yes |
Yes |
Yes |
Syntax
document.createComment(text)
Parameter Values
Parameter |
Type |
Description |
text |
String |
Optional. The text you want to be your comment, in the Comment object |
Technical Details
Return Value: |
A Comment Object, representing the created Comment node |
DOM Version |
Core Level 1 Document Object |
❮ Document Object