Skip to content

Instantly share code, notes, and snippets.

@hchouhan
Created April 25, 2018 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hchouhan/769c8ebc9bb07dd6572a8b4c60e2684b to your computer and use it in GitHub Desktop.
Save hchouhan/769c8ebc9bb07dd6572a8b4c60e2684b to your computer and use it in GitHub Desktop.
Block free mail
<input type="email" name="email" required placeholder="Enter Email"
oninvalid="this.setCustomValidity('Free email providers are not allowed')"
oninput="this.setCustomValidity('')"
pattern="^(?!.*@(?:hotmail|gmail|ymail|googlemail|live|gmx|yahoo|outlook|msn|icloud|facebook|aol|zoho|mail|yandex|hushmail|lycox|lycosmail|inbox|myway|aim|fastmail|goowy|juno|shortmail|atmail|protonmail)\.\w+$).*$"
/>
/**
lap [7:38 PM]
if you use oninvalid= do not forget the oninput="this.setCustomValidity('')"
else the message is stuck there
**/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment