JavaScript document.createComment() Method
You are Here:
JavaScript document.createComment() Method
The document.createComment()
method creates a new comment node, and returns it.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<p id="point">Click on the button</p>
<button onclick="myFunction()">Click Me</button>
<script>
var x = document.getElementById("point");
function myFunction(){
var comt = document.createComment("My p Comment");
x.appendChild(comt);
alert (x.innerHTML);
}
</script>
</body>
</html>
Syntax
document.createComment(data)
Parameter Values
Value | Type | Explanation |
---|---|---|
data | Required | A string containing the data to be added to the Comment. |
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.