input text type email code example

Example 1: input email tag

<input type="email" id="email" name="email">

Example 2: input type email

<label for="email">Enter your email:</label>
<input type="email" 
  id="email" name="email">

Example 3: TextInput is email type

validate = (text) => {
  console.log(text);
  let reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
  if (reg.test(text) === false) {
    console.log("Email is Not Correct");
    this.setState({ email: text })
    return false;
  }
  else {
    this.setState({ email: text })
    console.log("Email is Correct");
  }
}

Tags:

Html Example