1let test = document.getElementById("test");
2
3test.addEventListener("mouseover", function( event ) {
4 alert("mouse over test!")
5 , false);
1document.getElementById("myBtn").addEventListener("click", function() {
2 alert("Hello World!");
3});
1var element = document.getElementById("#id");
2element.addEventListener('click', function(){
3 console.log("click");
4});
1document.getElementById("example").addEventListener('click', function() {
2 alert('Click');
3});
1const element = document.querySelector(".class__name");
2
3element.addEventListener("click", () => {
4 console.log("clicked element");
5});
1var element=document.getElementById("some_id");
2var listener=element.addEventListener('click',function(event){
3
4 });