Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p>Click the button to create a CODE element with some text.</p>

<button onclick="myFunction()">Try it</button><br><br>

<script>
function myFunction() {
    var x = document.createElement("CODE");
    var t = document.createTextNode("A piece of computer code");
    x.appendChild(t);
    document.body.appendChild(x);
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy