1

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

  • 3
    possible duplicate of [Why don't self-closing script tags work?](http://stackoverflow.com/questions/69913/why-dont-self-closing-script-tags-work) – nemesv Jul 14 '12 at 07:35
  • your code looks fine .... validate the link to jquery library – Samih A Jul 14 '12 at 07:37

4 Answers4

8

There is a " in the <body"> tag

kerzek
  • 490
  • 1
  • 5
  • 15
6

Script tags should be closed like this:

 <script src="script/jquery-1.7.2.js" type="text/javascript"></script>
Suave Nti
  • 3,721
  • 11
  • 54
  • 78
1

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

ryuusenshi
  • 1,976
  • 13
  • 15
1

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" />
Waqar Janjua
  • 6,113
  • 2
  • 26
  • 36