Answers for "click button change innerHtml"

0

click button change innerHtml

Example-1:
const btn = document.querySelector(".btn");
const heading = document.querySelector(".heading");
btn.addEventListener("click", function () {
  heading.innerHTML = "Hello";
});


Example-2:

_e('btn').addEventListener('click', function() {
    _e('demo').innerHTML = 'Hey There';
}, false);

function _e(id) {
   return document.getElementById(id);
}
Posted by: Guest on March-21-2021

Code answers related to "click button change innerHtml"

Browse Popular Code Answers by Language