Forums

Cannot get JQuery Datepicker to work

peterswa62 03 Mar, 2014
I am trying to develop a JQuery datepicker control using your article as a guide:-

http://www.chronoengine.com/faqs/4010-how-can-i-add-a-jquery-datepicker

and on the JQuery site:-

http://jqueryui.com/datepicker/

I want to to be able to click on an empty text box which should then show the datepicker underneath, enabling you to select a date which should put the date in the box automatically. However when you click on the box nothing happens and I cannot figure why.

I have a custom element:- <div>Date: <input type="text" id="datepicker"></div>

I have this in a LoadJS event:-

<?php

JHtml::_('jquery.framework');
JHtml::_('jquery.ui');

$doc =& JFactory::getDocument();
// loaded from the code.jquery.com site

$doc->addStylesheet('//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css');

$doc->addScript(JURI::root().'components/com_chronoforms/extras/jquery/datepicker/development-bundle/ui/jquery.ui.datepicker.js');

?>

JQuery(function() {
JQuery "#datepicker" ).datepicker();
});

And a datepicker file on this link on my site:-

/public_html/components/com_chronoforms/extras/jquery/datepicker/development-bundle/ui/jquery.ui.datepicker.js
peterswa62 04 Mar, 2014
Answer
It's OK found out the problem. I was using JQuery instead of jQuery. You have to make sure you use lowercase j in jQuery when substituting the $ symbol.
This topic is locked and no more replies can be posted.