Validat email in the pattern of 'string@string.string'
This commit is contained in:
		
							parent
							
								
									19bbc409f9
								
							
						
					
					
						commit
						ad3e1f7ea4
					
				
					 2 changed files with 10 additions and 2 deletions
				
			
		|  | @ -10,3 +10,11 @@ function validatePassword(){ | ||||||
| } | } | ||||||
| password.onchange = validatePassword; | password.onchange = validatePassword; | ||||||
| confirm_password.onkeyup = validatePassword; | confirm_password.onkeyup = validatePassword; | ||||||
|  | 
 | ||||||
|  | function validateEmail(email) | ||||||
|  | { | ||||||
|  |     if(email.validity.patternMismatch) | ||||||
|  |         email.setCustomValidity('Please input correct email'); | ||||||
|  |     else | ||||||
|  |         email.setCustomValidity(''); | ||||||
|  | } | ||||||
|  | @ -29,7 +29,7 @@ | ||||||
|                             </div> |                             </div> | ||||||
|                             <div class="form-group"> |                             <div class="form-group"> | ||||||
|                                 <label for="email">Email:</label> |                                 <label for="email">Email:</label> | ||||||
|                                 <input class="form-control" type="email" id="email" required> |                                 <input class="form-control" type="email" id="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" oninput="validateEmail(this);" required> | ||||||
|                             </div> |                             </div> | ||||||
|                             <div class="form-group"> |                             <div class="form-group"> | ||||||
|                                 <label for="password">Password:</label> |                                 <label for="password">Password:</label> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Jack
						Jack