jai*_*ump 8 jquery jquery-ui datepicker
我Uncaught TypeError: Object [object Object] has no method 'datepicker'在这里的javascript中收到错误:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
<script type='text/javascript'>
$(function() {
$("#birthday").datepicker({changeMonth: true});
});
</script>
Run Code Online (Sandbox Code Playgroud)
这是我正在尝试将其添加到的生日项目:
<!--// BIRTHDAY //-->
<li class="field">
<label for="birthday">Birthday</label>
<div class="field"><input type="text" id="birthday" name="birthday" value="" class="" /></div>
</li>
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,我正在将jquery ui的源代码包含在我正在尝试使用datepicker的地方.我从http://jqueryui.com/docs/Downloading_jQuery_UI获取了URL,所以我很确定它是一个有效的URL.我也尝试上传文件并链接到本地副本,我仍然遇到同样的错误.我还能尝试什么?
编辑:
我确实使用这个加载了jquery库:<script type="text/javascript" src="/includes/js/jquery-1.7.2.min.js"></script>并使用以下脚本验证:
if (jQuery) {
alert("jQuery library is loaded!");
}
Run Code Online (Sandbox Code Playgroud)
Phi*_*idt 23
从我们的讨论中,我们发现$ variable(别名jQuery)的行为不正常.通常,这是因为另一个JS插件已更改$为代表其他内容.要解决这个问题,您可以像这样包装jQuery代码:
jQuery(function($){
//all jQuery code which uses $ needs to be inside here
});
Run Code Online (Sandbox Code Playgroud)
这将改变函数范围内$的含义.
| 归档时间: |
|
| 查看次数: |
21244 次 |
| 最近记录: |