Last active
December 17, 2016 05:26
-
-
Save danieldogeanu/bd57205e02e0cc8acf5f8fb7bcb20b1e to your computer and use it in GitHub Desktop.
An alternative to disable native Date/Time inputs, with the help of Modernizr.
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
// Disable Native Date/Time Inputs | |
var dateInputs = [ | |
'input[type="date"]', | |
'input[type="datetime"]', | |
'input[type="datetime-local"]', | |
'input[type="month"]', | |
'input[type="week"]', | |
'input[type="time"]' | |
]; | |
if (!Modernizr.touch) { | |
$.each(dateInputs, function(i, val){ | |
$(val).attr('type', 'text'); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment