jQuery onLoad 处理程序
我正在使用 jQuery 并尝试初始化选项卡 jQuery UI 小部件。我遇到的问题是我的 onload 处理程序没有被调用。我有一个 javascript 包含以下内容:
jQuery.ready(function () {
alert(0);
$('.autoTabs').tabs();
$('.dateField').datepicker({ dateFormat: 'dd-mm-yy', showOn: 'both', buttonImage: '/Images/calendar_16.png', direction: 'left', buttonImageOnly: true, changeMonth: true, changeYear: true });
$('.timeField').timepicker({});
});
然而,当文档加载时,没有显示任何内容,并且 IE 或 Firefox 中没有报告错误。
我过去广泛使用过 jQuery,但我很困惑为什么它不起作用。有问题的页面位于 http://chickenping.com/viewrecipes.aspx
I'm using jQuery and trying to initialize the tabs jQuery UI widget. The problem I have is that my onload handler isn't called. I have a javascript include with the following:
jQuery.ready(function () {
alert(0);
$('.autoTabs').tabs();
$('.dateField').datepicker({ dateFormat: 'dd-mm-yy', showOn: 'both', buttonImage: '/Images/calendar_16.png', direction: 'left', buttonImageOnly: true, changeMonth: true, changeYear: true });
$('.timeField').timepicker({});
});
Yet when the document loads, nothing is shown, and there are no reported errors in IE or Firefox.
I've used jQuery extensively in the past and I'm baffled as to why this isn't working. The page in question is at http://chickenping.com/viewrecipes.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要执行
$(function(){alert(0); })
或$(document).ready(function(){alert(0);})
You need to do either
$(function(){ alert(0); })
or$(document).ready(function(){alert(0);})
不应该是
因为您要求文档完成加载吗
Shouldn't it be
Since your asking for the document to finish loading
$(document).ready()
应该可以解决问题$(document).ready()
should do the trick