https://www.w3schools.com/Js/js_intro.asp

This is a simple example.

JavaScript Can Change HTML Content
One of many JavaScript HTML methods is getElementById().

The example below “finds” an HTML element (with id=“demo”), and changes the element content (innerHTML) to “Hello 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>