Guest User

Untitled

a guest
Nov 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. /**
  2. Only work if your form has a submit button
  3. */
  4. if ( ! HTMLFormElement.prototype.reportValidity) {
  5.  
  6. HTMLFormElement.prototype.reportValidity = function () {
  7.  
  8. var validity = this.checkValidity();
  9.  
  10. if ( ! validity) {
  11. var submitButtons = this.querySelectorAll("button, input[type=submit]");
  12.  
  13. for (var i = 0; i < submitButtons.length; i++) {
  14. if (submitButtons[i].type === "submit") {
  15. submitButtons[i].click();
  16. return validity;
  17. }
  18. }
  19. }
  20.  
  21. return validity;
  22. }
  23. }
Add Comment
Please, Sign In to add comment