datepicker codeigniter 2.2问题
您好,我正在尝试将 jquery datepicker 集成到我的 codeigniter 项目中。问题是我无法让它工作。我的源代码来自 http://view.jquery.com/tags/ui/latest/demos/function/#ui.datepicker 好的,这是我的代码:
查看:
<srcipt>
$("#formatted").datepicker({
dateFormat: $.datepicker.ISO_8601,
showOn: "both",
buttonImage: "templates/images/calendar.gif",
buttonImageOnly: true
});
</script>
<form action="add" method="post" class="form label-inline uniform" />
<input type="text" size="30" value="" id="formatted"/>
<input type="submit" class="btn btn-grey" value="Add User"/>
</form>
<script src="/assets/js/jquery/jquery-1.5.2.min.js"></script>
编辑 我已经添加了所有 js 源,但它仍然无法工作
<script src="/assets/js/jquery/jquery-1.5.2.min.js"></script>
<script src="/assets/js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="/assets/js/misc/excanvas.min.js"></script>
<script src="/assets/js/jquery/facebox.js"></script>
<script src="/assets/js/jquery/jquery.visualize.js"></script>
<script src="/assets/js/jquery/jquery.dataTables.min.js"></script>
<script src="/assets/js/jquery/jquery.tablesorter.min.js"></script>
<script src="/assets/js/jquery/jquery.uniform.min.js"></script>
<script src="/assets/js/jquery/jquery.placeholder.min.js"></script>
<script src="/assets/js/widgets.js"></script>
<script src="/assets/js/dashboard.js"></script>
编辑 为日期选择器创建了一个示例视图页面..即使图像的链接不起作用,仍然不起作用。
<html>
<head>
<script src="/assets/js/jquery/jquery-1.5.2.min.js"></script>
<script src="/assets/js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="/assets/js/misc/excanvas.min.js"></script>
<script src="/assets/js/jquery/facebox.js"></script>
<script src="/assets/js/jquery/jquery.visualize.js"></script>
<script src="/assets/js/jquery/jquery.dataTables.min.js"></script>
<script src="/assets/js/jquery/jquery.tablesorter.min.js"></script>
<script src="/assets/js/jquery/jquery.uniform.min.js"></script>
<script src="/assets/js/jquery/jquery.placeholder.min.js"></script>
<script src="/assets/js/widgets.js"></script>
<script src="/assets/js/dashboard.js"></script>
</head>
<body>
<script>
$("#formatted").datepicker({
dateFormat: $.datepicker.ISO_8601,
showOn: "both",
buttonImage: "http://pgoadmin.com/assets/images/calendar.gif",
buttonImageOnly: true
});
</script>
<form>
<input type="text" size="30" value="" id="formatted"/>
</form>
</body>
</html>
hi im trying to integrate a jquery datepicker to my codeigniter project.. the problem is that i cant get it to work .. my source code came from http://view.jquery.com/tags/ui/latest/demos/functional/#ui.datepicker
ok heres my code:
view:
<srcipt>
$("#formatted").datepicker({
dateFormat: $.datepicker.ISO_8601,
showOn: "both",
buttonImage: "templates/images/calendar.gif",
buttonImageOnly: true
});
</script>
<form action="add" method="post" class="form label-inline uniform" />
<input type="text" size="30" value="" id="formatted"/>
<input type="submit" class="btn btn-grey" value="Add User"/>
</form>
<script src="/assets/js/jquery/jquery-1.5.2.min.js"></script>
EDIT
i already added all the js sources but its still not working
<script src="/assets/js/jquery/jquery-1.5.2.min.js"></script>
<script src="/assets/js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="/assets/js/misc/excanvas.min.js"></script>
<script src="/assets/js/jquery/facebox.js"></script>
<script src="/assets/js/jquery/jquery.visualize.js"></script>
<script src="/assets/js/jquery/jquery.dataTables.min.js"></script>
<script src="/assets/js/jquery/jquery.tablesorter.min.js"></script>
<script src="/assets/js/jquery/jquery.uniform.min.js"></script>
<script src="/assets/js/jquery/jquery.placeholder.min.js"></script>
<script src="/assets/js/widgets.js"></script>
<script src="/assets/js/dashboard.js"></script>
EDIT
created a sample view page for datepicker.. still not working even the link for the image is not working.
<html>
<head>
<script src="/assets/js/jquery/jquery-1.5.2.min.js"></script>
<script src="/assets/js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="/assets/js/misc/excanvas.min.js"></script>
<script src="/assets/js/jquery/facebox.js"></script>
<script src="/assets/js/jquery/jquery.visualize.js"></script>
<script src="/assets/js/jquery/jquery.dataTables.min.js"></script>
<script src="/assets/js/jquery/jquery.tablesorter.min.js"></script>
<script src="/assets/js/jquery/jquery.uniform.min.js"></script>
<script src="/assets/js/jquery/jquery.placeholder.min.js"></script>
<script src="/assets/js/widgets.js"></script>
<script src="/assets/js/dashboard.js"></script>
</head>
<body>
<script>
$("#formatted").datepicker({
dateFormat: $.datepicker.ISO_8601,
showOn: "both",
buttonImage: "http://pgoadmin.com/assets/images/calendar.gif",
buttonImageOnly: true
});
</script>
<form>
<input type="text" size="30" value="" id="formatted"/>
</form>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要加载 jQuery UI 才能使用日期选择器
https ://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.js
不要忘记图像和 CSS:
http://jqueryui.com/download
You need to load in jQuery UI to use the date picker
https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.js
Dont forget the images and CSS as well:
http://jqueryui.com/download
在开始使用之前,您需要包含 jquery。尝试将 JS 代码移至 jquery 标签下方。
正如 Wes 所说,您还需要包含 jquery UI datepicker 组件。
另外,这可能是一个拼写错误,您的标签显示“sricpt”而不是“script”。
You need to include jquery before you start using it. Try moving the JS code below the jquery tag.
And as Wes says, you need to include jquery UI datepicker component as well.
Also, and this maybe a typo, your tag says "sricpt" instead of "script".
并且不要忘记添加 base_url();到你的 js 路径,
例如
and don't forget to add base_url(); to your js paths
e.g.