English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
createComment()The method creates a comment node with specified text.
document.createComment(text)
var c = document.createComment("This is a comment"); document.body.appendChild(c);Test See‹/›
All browsers fully support the createComment() method:
Method | |||||
createComment() | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
text | A string containing the text to be added to the comment |
Return Value: | The Comment object representing the Comment node created |
---|---|
DOM Version: | DOM Level1 |