Created
July 24, 2012 12:55
-
-
Save havvg/3169788 to your computer and use it in GitHub Desktop.
jQuery datepicker fallback on HTML5 date incompatible browsers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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