Reputation:
For some reason i can't seem to het jQuery to work in my asp.net page
I have sourced the jQuery library but the document.ready function never fires
i have also tried the window.load function as
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test Page</title>
<script src="script/jquery-1.7.2.js" type="text/javascript" />
<script type="text/javascript">
$(document).ready(function () {
alert('works');
});
</script>
</head>
<body">
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</div>
</form>
</body>
</html>
Thanks
Upvotes: 1
Views: 4480
Reputation: 1986
Maybe you didn't set up the script path correctly. To check that I would try importing Google hosted jQuery first.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
and also you really need to explicitly close the </script>
tag
Upvotes: 1
Reputation: 6123
Once I have the same problem but when I use google ajax api it works for me. Try it
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" />
Upvotes: 1
Reputation: 3757
Script tags should be closed like this:
<script src="script/jquery-1.7.2.js" type="text/javascript"></script>
Upvotes: 6