【发布时间】:2015-03-26 07:51:19
【问题描述】:
我已经在我的 asp.net 主文件中添加了 jquery.min.js 文件,并且我正在将相同的母版页添加到我的子 .aspx 页面中,但是我收到了这个错误
`TypeError: $ is not a function
-$(document).ready(function () {`
当我将 jquery 引用文件添加到母版页时,我无法找出为什么会出现此错误:
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
这里是我使用 jquery 的地方:
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript">
var dateFrom = null;
var dateto = null;
var empID = null;
$(document).ready(function () {
$("#Button1").click(function () { // On button click we must show the grid
dateFrom = $("#TextBox4").val();
dateto = $("#TextBox5").val();
empID = $("#TextBox1").val();
$("#UsersGrid").GridUnload(); // Unload the table before loading grid. This will clear the previously loaded UI in grid. Because in JQgrid UI is built at run time.
gridload(); // Call the function to load the grid
});
});
【问题讨论】:
-
你在哪里包括jQuery?在脚本中使用它之前是否包含它?
-
你应该在你的 Jquery 脚本之前包含 jquery Lib
-
@PaulTomkiel 我将 jQuery 包含到母版页中,并将该母版页引用到子页中。
-
向我们展示您生成的 HTML
-
Master Page和Child Page在同一directory中?