简体   繁体   中英

jQuery not working in ASP 2.0 page - Visual Web Developer 2008 Express

JQuery is not working in ASP 2.0 pages which were developed under VS 2005 and now doing Javascript in it using Visual Web Developer 2008 Express. I have included the jquery file. I have also installed all patches required. JQuery intellisense works fine in the IDE, but no jquery command is running. btw, the page renders fine from the server side coding.

Please give some remedy to this, and whats the problem in the code?

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%@ Register Src="Calendar.ascx" TagName="Calendar" TagPrefix="uc1" %>

 <!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>Control Trial Page</title>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />

<script language="javascript" type="text/javascript" src="Scripts/jquery-1.3.2.js">
   $(document).ready(function() {
      $("#divBody").css("display", "none");
    });
</script>
</head>
<body>
<form id="form1" runat="server">
    <div>
        <input id="showDiv" type="button" value="hi there"/> 
    </div>
    <div id="divBody">
 ....

</html>

You need 2 script tags. One which imports the jQuery.js file and one which contains your script. Observe:

<script language="javascript" type="text/javascript" src="Scripts/jquery-1.3.2.js"></script>
<script language="javascript" type="text/javascript">
    $(document).ready(function() {
        $("#divBody").css("display", "none");
    });
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM