Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Validate HTML Inputs w/ Pattern Attribute
<!-- Example: validate for specific URL (one that ends in -->
<input type="url" id="site" name="site" pattern="(https://)+[a-zA-z0-9-/:]+(" title="Enter a URL">
<!-- Example: validate for specific email (one that ends in -->
<input type="email" id="email" name="email" pattern="^[A-Za-z0-9._%+-]+@example\.com$" title="Enter a valid email address">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment