Why is my JS not working?
(JS Fiddle for context: https://jsfiddle.net/qLry5cwx/2/)
The js is supposed to display a modal but it appears to not even try to execute. The code still works in another project of mine, from which I ripped all of the code, but not on my new site. I cannot figure out for the life of me why it isn't working. Can someone help me? Cheers
5 Replies
This isn't returning anything because there is no
class="download-btn"
The console says so:
The download button is on a different page, but I don't see how that can affect the js for the modal
because certain errors stop javascript execution
the rest of the file never runs because you're trying to set a listener on a non-existent element
How can I fix it then?
gotta fix or prevent that error from occurring, then the rest will work again
the quick and dirty method is to do this:
instead of just