1const element = document.querySelector(".class__name");
2
3element.addEventListener("click", () => {
4 console.log("clicked element");
5});
1document.querySelector("button").addEventListener("click", handle);
2
3function handle() {
4 alert("I got clicked")
5}
1element.addEventListener("click", function(){
2 element.innerText = "something";
3});
1document.querySelector('div').addEventListener('click', () => {
2 console.log('div clicked');
3});