Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- Only work if your form has a submit button
- */
- if ( ! HTMLFormElement.prototype.reportValidity) {
- HTMLFormElement.prototype.reportValidity = function () {
- var validity = this.checkValidity();
- if ( ! validity) {
- var submitButtons = this.querySelectorAll("button, input[type=submit]");
- for (var i = 0; i < submitButtons.length; i++) {
- if (submitButtons[i].type === "submit") {
- submitButtons[i].click();
- return validity;
- }
- }
- }
- return validity;
- }
- }
Add Comment
Please, Sign In to add comment