jQuery in Visual Studio 2010 not working

Greetings, experts.

I am new to jQuery and decided to take the plunge.  I use Visual Studio 2010 ASP.NET for web development.

I downloaded the newest version of jQuery, 1.5, and added the file to the project.  I also found a version of the -vsdoc for 1.5 and added it in the same way.  The jQuery Intellisense seems to work fine.

After following all the steps for the typical "Hello World" test, nothing happens.

What have I missed?
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Text-jQuery.aspx.vb" Inherits="Text_jQuery" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script src="scripts/jquery-1.5.min.js" type="text/javascript"></script>
    <script src="scripts/jquery-1.5-vsdoc.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            $("a").click(function () {
                alert("Hello World!");
            });
        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <a href="#">Click Here</a>
    </div>
    </form>
</body>
</html>

Open in new window

ewolsingAsked:
Who is Participating?
 
jorge_torizConnect With a Mentor Research & Development ManagerCommented:
I have created an HTML page with the code that you posted, but I don't have the vsdoc file, so I didn't put that reference... if you remove that reference still not working?
0
 
jorge_torizResearch & Development ManagerCommented:
Mmm... if you add the attribute language="javascript"?
0
 
ewolsingAuthor Commented:
jorge toriz:

I added, language="javascript", to the script tag containing the Hello World jQuery code, but to no avail.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
jorge_torizResearch & Development ManagerCommented:
<script src="scripts/jquery-1.5.min.js" type="text/javascript" language="javascript"></script>
<script src="scripts/jquery-1.5-vsdoc.js" type="text/javascript" language="javascript"></script>

Mmm... can you post the HTML result of your execution?
0
 
ewolsingAuthor Commented:
I added, language="javascript", to the tags defining the location of the jQuery libraries.

I executed the page and clicked the link, but still did not receive the expected alert box.

Per request, the HTML received *after* I clicked the link is included.  I hope it helps.  I've been scratching my head on this for the last several hours.  From everything I've read, it should work.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>

</title>

    <script src="scripts/jquery-1.5.min.js" type="text/javascript" language="javascript"></script>
    <script src="scripts/jquery-1.5-vsdoc.js" type="text/javascript" language="javascript"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            $("a").click(function () {
                alert("Hello World!");
            });
        });
    </script>

</head>
<body>
    <form name="form1" method="post" action="Text-jQuery.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2MTY2ODcyMjlkZEuZOv2bq3N7hsYmQUVPH9OqZ1C3xiqDh1uS1F+Iy7wd" />
</div>

    <div>
        <a href="#">Click Here</a>
    </div>
    </form>

</body>
</html>

Open in new window

0
 
jorge_torizResearch & Development ManagerCommented:
When you run your test, there must be a ASP .NET Development Server... as an example, is suppose that is "http://localhost:12345/YouTest/Default.aspx"

If you visit "http://localhost:12345/YourTest/scripts/jquery-1.5.min.js" and "http://localhost:12345/YourTest/scripts/jquery-1.5-vsdoc.js"... do you get the scripts?
0
 
ewolsingAuthor Commented:
I checked that the directories in which the scripts are located are available to ASP.NET.  As you suggeseted, I attempted to access the jQuery libraries from the address bar of my browser and did so successfully.  When I entered the address, the jQuery library I selected displayed with no problem.

That suggests it's not an ASP.NET directory access issue.
0
 
ewolsingAuthor Commented:
Wow!  I commented out the vsdoc reference and it worked!

I suppose my next question is how I can retain the intellisense functionality without having to repeatedly comment and un-comment the vsdoc reference?
0
All Courses

From novice to tech pro — start learning today.