Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

add click event listener javascript

//html
<button>My Button</button>

document.querySelector("button").addEventListener('click', handlClick);

function handlClick() {
    alert("I got clicked!")
}
 
PREVIOUS NEXT
Tagged: #add #click #event #listener #javascript
ADD COMMENT
Topic
Name
4+7 =