1.Change text on click
BeginnerWhen the button is clicked, change the heading to Welcome to Laviyx Learn.
<h1 id="title">Hello</h1>
<button id="change">Change heading</button>Show hint
Select both elements, then use addEventListener("click", ...) and set textContent.
Show solution
const title = document.querySelector("#title");
const button = document.querySelector("#change");
button.addEventListener("click", () => {
title.textContent = "Welcome to Laviyx Learn";
});