<p id="js-text">これはHTMLにかいてあるテキストです</p>
<button id="js-button">押してね!</buttton>
const button = document.getElementById("js-button");
const text = document.getElementById("js-text");
const changeText =()=>{
text.textContent="→ DOMがテキストを書き換えました!"
}
button.addEventListener("click", changeText);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.