what is the difference between type="text" and type="name or email"?when we use only text and when we put the specific thing lik | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is the difference between type="text" and type="name or email"?when we use only text and when we put the specific thing lik

31st Aug 2020, 2:36 AM
Athraa Faraj Sagban
6 Answers
- 4
Type = text means you can type in anything but type = email requires you to put a valid email before submitting a form. I think there is no type = name.
31st Aug 2020, 3:02 AM
Dragon
Dragon - avatar
+ 4
type = "text" means you can type in anything in that input field before submitting but type = "email" requires you to put a valid email before submitting a form. I think there is no type = "name", i checked it on w3schools.
31st Aug 2020, 3:01 AM
maf
maf - avatar
+ 4
Rakshit you just copied my answer :P
31st Aug 2020, 3:04 AM
maf
maf - avatar
+ 3
There is no value `name or email` of the attribute `type` of the tag `input`. There is a `name` attribute of the tag `input` which is VERY important in when you are using a form `datalist` or input type select. The name attribute is also a Global Attribute, a set of attributes that are available in all tags. The difference between <input type="email"> (which is valid HTML) and <input type="text"> is that in the first input, you cannot type anything other than an email address. If you try to submit the form with an invalid email address, it will show you an error. You can, however, enter an email address with an unknown domain suffix. So, i.aswe@htmlformsexperts.com would be a perfectly valid email address. The same is true for <input type="url">, which will only accept a valid URL (Uniform Resource Locator).
31st Aug 2020, 2:50 AM
Devansh Patil [INACTIVE]
Devansh Patil [INACTIVE] - avatar
+ 1
thank you guys
4th Sep 2020, 3:26 AM
Athraa Faraj Sagban
- 2
But this is the answer
31st Aug 2020, 4:52 AM
Dragon
Dragon - avatar