Reputation: 738
I'm trying to add the bootstrap-datepicker plugin to a Drupal custom module based page. My problem is the function below does not give any sort of errors but the datepicker never shows up.
jQuery(document).ready(function () {
jQuery('#datepicker1').datepicker({
format: 'mm-dd-yyyy'
});
});
I have added both bootstrap-datepicker.js and datepicker.css using the info file
stylesheets[all][] = stylesheets/datepicker.css
scripts[] = js/bootstrap-datepicker.js
scripts[] = js/filterBlock.js
Am I missing something?
Upvotes: 1
Views: 2611
Reputation: 738
I had to add jQuery.js once more to the module info file even though I had enabled the jQuery Update plugin. But now it's working.
scripts[] = js/jquery-1.7.1.min.js
scripts[] = js/bootstrap-datepicker.js
stylesheets[all][] = stylesheets/style.css
stylesheets[all][] = stylesheets/datepicker.css
Is there a better solution? Does any one know why I have to add the jQuery.js once again? I have some other issues with bootstrap elements like panel when I add this jQuery like this.If someone can guess what is missing without the jQuery for the bootstrap-datepicker it would be great.
Upvotes: 1
Reputation: 925
I'm not familiarized with drupal, but recently I have used bootstrap on a Struts2 project. Even though I used Bootstrap, ended up using jQueryUI Datepicker (http://jqueryui.com/datepicker/), which not only works perfectly, but also brings the possibility of adapting it to a (http://trentrichardson.com/examples/timepicker/TimePicker).
Upvotes: 0