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`:

/** @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?

remarkablecontent
 
Uranus replied on at Permalink Reply
Uranus
this usually happens when the jquery core and/or the datepicker js is not being loaded. check if it's loading (a 200 response). Make sure you have the correct paths and proper read permissions.

also, make sure the jquery core is loaded before the datepicker, and that datepicker is loaded before $( '#datepicker' ).datepicker() .
remarkablecontent replied on at Permalink Reply
remarkablecontent
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
remarkablecontent replied on at Permalink Reply
remarkablecontent
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.
Uranus replied on at Permalink Reply
Uranus
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.
remarkablecontent replied on at Permalink Reply
remarkablecontent
Thanks, that appears to be it. The error msgs gave no clues that it was being loaded twice!