datepicker codeigniter 2.2问题

发布于 2024-11-08 02:49:49 字数 2943 浏览 0 评论 0原文

您好,我正在尝试将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

思慕 2024-11-15 02:49:50

您需要加载 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

長街聽風 2024-11-15 02:49:50

在开始使用之前,您需要包含 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".

橘亓 2024-11-15 02:49:50

并且不要忘记添加 base_url();到你的 js 路径,

例如

<script src="<?php echo base_url(); ?>assets/js/dashboard.js"></script>

and don't forget to add base_url(); to your js paths

e.g.

<script src="<?php echo base_url(); ?>assets/js/dashboard.js"></script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文