In this article, we learn how to change the text value in javascript.
HTML
<!DOCTYPE html>
<html>
<head>
<title>Change the text value</title>
</head>
<body>
<form>
<h1 id="text_id">Hello, Codermen</h1>
</form>
<input type="button" value="Check" onclick="myFunction()" />
</body>
</html>
Javascript
The Element
property innerHTML
gets or sets the HTML or XML markup contained within the element.
function myFunction() {
document.getElementById("text_id").innerHTML = "I am Fine!";
}

Brijpal Sharma is a web developer with a passion for writing tech tutorials. Learn JavaScript and other web development technology.