mercredi 8 août 2018

How do I check if an input field value contains a character?

 var email = document.querySelector('#issueContactEmail');


 if (email.value.includes('@')) {
    console.log('has @');
    return valid;
}

I have a form with an input with the id of issueContactEmail

I would like to check if there is an @ symbol in the input value before the user can go forward. My code here does not seem to work.

How else can I check this? If you could briefly explain why this doesn't work that would be great too! thank you in advance

Aucun commentaire:

Enregistrer un commentaire