Thursday 10 January 2019

html - How to make Event Listeners work with external Javascript File?

I have these simple files -






document.getElementById("btn2").addEventListener("click",function(){
alert("Did it work?");
});















which work correctly here and also on jsFiddle, but when I run this on my computer locally, the EventListener won't work! I've been trying to fix this all day and no success. What is the problem? I just cannot seem to figure it out!

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...