Home / kinkchat / Code for validating email in javascript

Code for validating email in javascript

While our message will be easily spotted by sighted users, people using assistive technology like screen readers may not inherently know a message has been added to the DOM.

code for validating email in javascript-84code for validating email in javascript-88

See the Pen Form Validation: Mail Chimp with Ajax Submit by Chris Ferdinandi (@cferdinandi) on Code Pen.

See the Pen Form Validation: The Mail Chimp Simple Signup Form by Chris Ferdinandi (@cferdinandi) on Code Pen.

Now, let's add in a few input types and validation attributes so that the browser can natively validate the form for us.

Our validation script is just 6.7kb minification, making it 20x smaller than the one Mail Chimp provides.

If we want to ensure support back to IE9, though, we should include our Validity State polyfill and Eli Grey's class polyfill.

370 comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*