Answers for "how to change html text in dom"

1

set text of dom element

document.getElementById("myBtn").textContent = 'Hello World';
Posted by: Guest on March-05-2020
0

how to change text in html using javascript

<!DOCTYPE html>
<html>
<body>

<h2>What Can JavaScript Do?</h2>

<p id="demo">JavaScript can change HTML content.</p>

<button type="button" onclick='document.getElementById("demo").innerHTML = "Hello JavaScript!"'>Click Me!</button>

</body>
</html>
Posted by: Guest on April-25-2022

Code answers related to "how to change html text in dom"

Code answers related to "Javascript"

Browse Popular Code Answers by Language