I need a button that changes the class of different elements, I tried this this way :
<button id="class-button">class change</button>
<div id="title">this is the title</div>
<script>
document.getElementById("class-button").addEventListener("click", () => {
document.getElementById("title").event.target.classList.add("the-class")
}
</script>
and that failed.