I have a very simple HTML file that looks like this:
<html>
<head>
<script src="jquery-1.11.1.min.js"></script>
<script src="mainScript.js"></script>
</head>
<body>
<button id = "theButton" type="button">Click Me!</button>
</body>
</html>
mainScript.js looks like this:
$("#theButton").click(function() {
alert( "Handler for .click() called." );
});
Nothing happens when I click though. If I put an alert into the JS file it will happen. If I run that snippet of JS in the console, then when I click the button it will work. I've tested that jQuery is loaded, and it is. I've also put this code in JS Fiddle and it works (http://jsfiddle.net/ds59ruvu/). What stupid thing am i doing locally that's preventing this from working?