Skip to content

Instantly share code, notes, and snippets.

@achillar
Created December 28, 2015 13:07
Show Gist options
  • Save achillar/b1a0d8a124c9eeff3b3a to your computer and use it in GitHub Desktop.
Save achillar/b1a0d8a124c9eeff3b3a to your computer and use it in GitHub Desktop.
Using jQuery Datepicker as a failback for input type="date" fields
if (jQuery('[type="date"]').prop('type') !== 'date') {
document.write(unescape('%3Clink href="' + bcm.web_design_path + '/css/bootstrap-datepicker/datepicker3.css" rel="stylesheet" type="text/css" /%3E'));
document.write(unescape('%3Cscript src="' + bcm.web_design_path + '/js/plugins/bootstrap-datepicker/bootstrap-datepicker.js"%3E%3C/script%3E'));
document.write(unescape('%3Cscript src="' + bcm.web_design_path + '/js/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.es.js"%3E%3C/script%3E'));
jQuery(document).ready(function () {
jQuery('[type="date"]').datepicker({
format: "yyyy-mm-dd",
todayBtn: true,
language: "es",
autoclose: true,
todayHighlight: true
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment