Skip to content

Instantly share code, notes, and snippets.

@havvg
Created July 24, 2012 12:55
Show Gist options
  • Save havvg/3169788 to your computer and use it in GitHub Desktop.
Save havvg/3169788 to your computer and use it in GitHub Desktop.
jQuery datepicker fallback on HTML5 date incompatible browsers
jQuery(function($) {
var $inputs = $('input[type="date"]');
if (!$inputs.length) return;
/*
* The browser does not support the HTML5 date type.
*
* We add the datepicker as a fallback.
*/
if ('date' !== $inputs.get(0).type) {
$inputs.attr('data-datepicker', 'datepicker');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment