HTML Validation for Phone Numbers

I am new to HTML, can someone help me confirm the phone number with only “+”, and the numerical values ​​and phone number do not exceed 13 numbers, and also for checking email with “@” and “.”, I don’t want to use javascript

+4
source share
3 answers

In HTML5 you can use <input type='tel'>and<input type='email'>

You can also specify a specific template, for example <input type='tel' pattern='[\+]\d{2}[\(]\d{2}[\)]\d{4}[\-]\d{4}' title='Phone Number (Format: +99(99)9999-9999)'>

Something like pattern='^\+?\d{0,13}'Would give you an extra + and up to 13 digits

+8
source

Email Verification - <input type="email" />Use this type as email.

- <input type="tel" />. tel.

:

https://www.sitepoint.com/client-side-form-validation-html5/

HTML5

HTML5 Email

0

HTML and / or JavaScript will only check email on the client side, a safer solution is to check email on the server side. Having said that you can do a basic check in HTML 5, for example

<form>
<input type="email" placeholder="Your email" required>
<input type="submit" value="Submit">
</form>
0
source

All Articles