How to change HTML text ?

The code below is used to make html text change to another text.This is done by using a important text, it is .getElementById.
This changes the html text because it finds the id idea from a tag. And when we click the button javascript coding will change the text.


<html>
<body>

<h1>Changing html text</h1>

<p id="idea">
My name is Matthew Benedict
</p> <button type="button"
onclick='document.getElementById("idea")
.innerHTML="I live in chennai"'>press
</button> </body> </html>

Changing html text

My name is Matthew Benedict