Skip to content

Instantly share code, notes, and snippets.

@edysegura
Last active April 28, 2023 06:22
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save edysegura/9984108 to your computer and use it in GitHub Desktop.
Save edysegura/9984108 to your computer and use it in GitHub Desktop.
How to prevent the browser from showing default HTML5 validation error message bubble?
document.addEventListener('invalid', (function(){
return function(e) {
//prevent the browser from showing default error bubble / hint
e.preventDefault();
// optionally fire off some custom validation handler
// myValidation();
};
})(), true);
@BlkPingu
Copy link

BlkPingu commented Oct 4, 2019

works great ty

@amirkhiz
Copy link

Thanks

@Loredana-Elena
Copy link

It works, thanks

@atanas-rujinov
Copy link

<3

@Dirigentas
Copy link

TY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment