📅  最后修改于: 2022-03-11 14:56:05.157000             🧑  作者: Mango
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);
}