Answers for "change element to h1 javascript"

PHP
1

js change h1 value

document.getElementById("yourH1_element_Id").innerHTML = "yourTextHere";
Posted by: Guest on October-06-2020
0

how would you create a new h1 element with javascript

<!DOCTYPE html>
<html>
<body>

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

<button onclick="myFunction()">Click to create</button>

<script>
function myFunction() {
    var myStyle = document.createElement("H1");
    var myText = document.createTextNode(prompt("This is an example of text written in H1");
    h.appendChild(myText);
    document.body.appendChild(myStyle);
}
</script>

</body>
</html>
Posted by: Guest on May-20-2021

Browse Popular Code Answers by Language