validate email input javascript onchange

Solutions on MaxInterview for validate email input javascript onchange by the best coders in the world

showing results for - "validate email input javascript onchange"
Sofia
23 Apr 2017
1 <script type="text/javascript">
2 function ShowAlert() {
3  var email = document.getElementById('txtEmailId');
4  var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
5    if (!filter.test(email.value)) {
6        alert('Please provide a valid email address');
7        email.focus;
8        return false;
9    }
10    else {
11        alert("Thanks for your intrest in us, Now you 
12        will be able to receive monthly updates from us.");
13        document.getElementById('txtEmailId').value = "";
14    }
15 }
16 </script> 
Mellina
02 Feb 2018
1   <input input type="text" name="txtEmailId" id="txtEmailId" /> 
2   <input type="submit" class="button" value="Suscribe" name="Suscribe" 
3            onclick="javascript:ShowAlert()" />