Skip to content

Instantly share code, notes, and snippets.

@danieldogeanu
Last active December 17, 2016 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danieldogeanu/bd57205e02e0cc8acf5f8fb7bcb20b1e to your computer and use it in GitHub Desktop.
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.
// 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