Created
November 2, 2016 15:03
-
-
Save skew202/00bdab78878667300cedbcf04945ff59 to your computer and use it in GitHub Desktop.
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
// plainforms.js | |
// https://github.com/bgrins/devtools-snippets | |
// Remove HTML5 form features (validations and special input types). | |
(function () { | |
['maxlength', 'required', 'min', 'max', 'pattern', 'step' ].forEach(function (attr) { | |
[].forEach.call(document.querySelectorAll("[" + attr + "]"), function (node) { | |
node.removeAttribute(attr); | |
}); | |
}); | |
['tel', 'url', 'email', 'datetime', 'date', 'month', 'week', 'time', 'datetime-local', 'number', 'range', 'color'].forEach(function (type) { | |
[].forEach.call(document.querySelectorAll("input[type=" + type + "]"), function (node) { | |
node.setAttribute('type', 'text'); | |
}); | |
}); | |
console.info("All HTML5 form validations have been removed."); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment