So I have a very simple .Net page that uses JQuery. When I place the code directly on the page the script executes fine, but when I call from an external js page it fails.
$(document).ready(function () {
$("#MainContent_Button1").click(function () {
alert("Hello world!");
});
});
(jQuery)
<asp:Button ID="Button1" CssClass="Button1" runat="server" Text="CLICK ME FOO" />
When I link like so:
<script type="text/javascript" src="menu.js"></script>.
It doesn't work, but if I place on the page it works fine.
$(function() {..})in an external JS file? When do you load the external file?