Meteor JS: Validating an email quickly

This code can be used in other technologies too.



<input type="text" class="email form-control" 
placeholder="E-Mail" value="{{}}">


if ( $('.email').val().length > 0 ){
    if(!/^[a-zA-Z0-9][a-zA-Z0-9\._-]+@([a-zA-Z0-9\._-]+\.)[a-zA-Z-0-9]{2}/.test($('.email').val())) {
        alert("Please enter a valid email.");

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s