forked from bgrins/devtools-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplainforms.js
More file actions
20 lines (16 loc) · 733 Bytes
/
plainforms.js
File metadata and controls
20 lines (16 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 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.");
})();