Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 763
  • Last Modified:

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

0
ewolsing
Asked:
ewolsing
  • 4
  • 4
1 Solution
 
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
 
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
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
 
jorge_torizResearch & 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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now