Reputation: 11
Greeting for some reason my -addEventListener is not executing when I click the button. Can anyone help this is my code:
function elNegro() {
alert("Thank You For Your Subscription!");
}
var week = document.getElementById("get");
week.addEventListener("click", elNegro);
Upvotes: 0
Views: 58
Reputation: 30739
The code works fine. Check the snippet. You may have javascript disabled for your browser. Ensure it is enabled and check for parenthesis for the code you are writing. Also, make sure the element with id get
is present in your HTML.
function elNegro() {
alert("Thank You For Your Subscription!");
}
var week = document.getElementById("get");
week.addEventListener("click", elNegro);
<div>
<button id='get'>Get Button</button>
</div>
Upvotes: 2