开发者

datepicker codeigniter 2.2 problem

开发者 https://www.devze.com 2023-03-06 11:37 出处:网络
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/#

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="/a开发者_Go百科ssets/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>


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


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".


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号