我不断收到以下错误消息未定义的错误消息: 微软JScript运行时错误:“$”是未定义
我已经包括像这样的jQuery UI的js文件:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>jquery Test Page</title>
<script src="@Url.Content("~/Scripts/jquery-1.4.1.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11-min.js")" type="text/javascript"></script>
<script>
$(function() {
$('#startdate').datepick({ dateFormat: 'dd/mm/yyyy' });
});
</script>
</head>
<body>
<form id="form1" runat="server">
jquery date picker test: <asp:TextBox ID="startdate" runat="server"></asp:TextBox>
</form>
</body>
</html>
我认为这个问题是与URL.CONTENT包括 - 编译器抱怨说,它无法找到在Url.Content行的js文件。但是我可以在我的解决方案文件夹中看到它们 - 它们绝对包含在脚本文件夹中。我想我的报价,但我无法弄清楚它是什么。我试着改变Url.Contents内部的实际文件名来使用单引号而不是双引号。但是这并没有解决问题。我也试过没有引号。
也许你可以看到我错过了什么 - 我敢肯定它简单的东西,我忽略了。
您脚本缺少'jQuery库'..在jQuery UI之前包含jQuery库 – thecodeparadox 2012-07-31 13:30:17
如果您在路径中硬编码,它会工作吗? – Tim 2012-07-31 13:37:37