I'm trying to assign a function to a button using javascript, but for some reason it's not working. This is the button in question. At this point I'm just trying to make it responsive.
<button id="artbtn" class="artbtn btn">Art</button>
In the Chrome developer console I tried this:
document.getElementsByClassName("artbtn")[0].addEventListener(
"click", function(){
alert("hi")
})
and it did what I wanted, it threw up an alert. But when I tried using that script on the page... no response.
I'm using angular v1.2.7 with node.js which probably is contributing to this but I'm not sure what exactly is happening.
via Jordan Forbes
No comments:
Post a Comment