TypeError: $(...).datepicker is not a function
Permalink
I'm trying to use a standard datepicker on a public page, via the `Concrete5_Helper_Form_DateTime`:
But I get the above error.
I'm usinghttp://www.concrete5.org/marketplace/addons/load-jquery-ui/... so the ui js file is loaded.
The c5 helper adds the following after the input:
<script type="text/javascript">$(function() { $("#dt_from_sc").datepicker({ dateFormat: 'dd-mm-yy', changeYear: true, showAnim: 'fadeIn' }); });</script>
Any ideas?
/** @var Concrete5_Helper_Form_DateTime $dtt */ $dtt = Loader::helper('form/date_time'); echo $dtt->date('dt_from');
But I get the above error.
I'm usinghttp://www.concrete5.org/marketplace/addons/load-jquery-ui/... so the ui js file is loaded.
The c5 helper adds the following after the input:
<script type="text/javascript">$(function() { $("#dt_from_sc").datepicker({ dateFormat: 'dd-mm-yy', changeYear: true, showAnim: 'fadeIn' }); });</script>
Any ideas?
The files all load fine, and the call to datpicker is in a (shorthand) `$(document).ready()` as you can see. c.f.http://api.jquery.com/ready/
The versions (which came with C5) are: jq v1.7.2 and jqui v1.8.16
The versions (which came with C5) are: jq v1.7.2 and jqui v1.8.16
It appears to be an issue with the order in which the files are loaded, ui before jq.
So I'm trying to add files to the header or footer or to override header_required.php and it's just a mess.
So I'm trying to add files to the header or footer or to override header_required.php and it's just a mess.
Please uninstall the addon 'Load jQuery.UI' and check it is working or not. As I have checked the datepicker is working perfectly no need to install 'Load JQuery UI' addon.
Thanks, that appears to be it. The error msgs gave no clues that it was being loaded twice!
also, make sure the jquery core is loaded before the datepicker, and that datepicker is loaded before $( '#datepicker' ).datepicker() .