Easy Tutorial
❮ Jsref Prototype Date Dom Obj Input Time ❯

HTML DOM createComment() Method

Document Object

Example

Creates a comment node and inserts it into the HTML document:

Output result:


Definition and Usage

The createComment() method creates a comment node.


Browser Support

All major browsers support the createComment() method.


Syntax

Parameters

Parameter Type Description
text String Optional. The comment text to be added.

Return Value

Type Description
Comment object The created comment node

Technical Details

| DOM Version | Core Level 1 Document Object | | --- | --- |


Document Object

❮ Jsref Prototype Date Dom Obj Input Time ❯