Return To CS 100 Home

Change Text With JS

How do I change the text on a page?

You change the text on the HTML page by using the innerHTML property in your javascript function. For example:

document.getElementById("idname1").innerHTML="The text it will change to";