Answers for "if button is pressed js"

0

if button is pressed js

<button>A</button>
<button>B</button>
<button>C</button>
<script>
  document.body.addEventListener("click", event => {
    if (event.target.nodeName == "BUTTON") {
      console.log("Clicked", event.target.textContent);
    }
  });
</script>
Posted by: Guest on March-31-2021

Code answers related to "if button is pressed js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language