Newer
Older
hello-programmer-world / public / sample / js / edit-content.html
<p id="text">こんにちは!</p>
<button id="btn">変更</button>

<script>
  const text = document.querySelector("#text");
  const btn = document.querySelector("#btn");

  btn.addEventListener("click", () => {
    text.textContent = "こんばんは!";
  });
</script>