JSFiddle - React, Tailwind, and code Playground

by qoalu

HTML

<form action="#" method="post" class="">
  <input name="email" id='email' class="cta__input" placeholder="Email" type="email"...

JavaScript

var input = document.getElementById('email');

input.oninput= function(event) {
		console.log(event);
    if (event.target.validity.patternMismatch && !event.target.validity.typeMismatch) {
	    console.log('custom');
    	event.target.setCustomValidity('Please use a valid TLD');
      return;
    }
    event.target.setCustomValidity('');
}