If you are sure that the users of your web page are using HTML5 compatible browsers you can use the following neater example for the same purpose:
<!DOCTYPE html>
<html>
<body>
<form>
<input type="email" pattern="^[a-zA-Z0-9\-_]+(\.[a-zA-Z0-9\-_]+)*@[a-z0-9]+(\-[a-z0-9]+)*(\.[a-z0-9]+(\-[a-z0-9]+)*)*\.[a-z]{2,4}$">
<input type="submit">
</form>
</body>
</html>
No comments:
Post a Comment