
document.getElementById("emailVal").innerHTML = "Valid e-mail can contain only latin letters, numbers, and '.'" ĭocument.getElementById("emails").innerHTML = "" ĭocument.getElementById("phones").innerHTML = "required" ĭocument.getElementById('trainerPhone').scrollIntoView() ĭocument.getElementById("phones").innerHTML = "Invalid phoneNo (Valid Phone number must be numbers only and have 10 digits)" Var phone = document.getElementById('contact').value ĮmailRegex = /^\(?()$/ ĭocument.getElementById("nameFirst").innerHTML = "required" ĭocument.getElementById('first').scrollIntoView() ĭocument.getElementById("nameFirst").innerHTML = "Only alphabets are allowed" ĭocument.getElementById("nameFirst").innerHTML = "" ĭocument.getElementById("nameLast").innerHTML = "required" ĭocument.getElementById('last').scrollIntoView() ĭocument.getElementById("nameLast").innerHTML = "Only alphabets are allowed" ĭocument.getElementById("nameLast").innerHTML = "" ĭocument.getElementById("emails").innerHTML = "required" ĭocument.getElementById('trainerEmail').scrollIntoView() ĭocument.getElementById("emails").innerHTML = "Invalid email (Valid e-mail can contain only latin letters, numbers, and '.')" Var email = document.getElementById('email').value Var lastName = document.getElementById('lastName').value Var firstName = document.getElementById('firstName').value


and if I write email as- it will show the error because of the validationīut if I write It is NOT showing any error. I am new to JavaScript and I am trying to put Email validation through JavaScript and its working fine but If I add this in the email(refer the image)ĭescription- For example if I type email as- is works fine as its syntax is correct.
