Forms | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Forms

Whats the difference between the id=“” and the type=“” in the forms

28th Aug 2018, 11:53 AM
dun
2 Réponses
0
For example in html <form> <input id=“name” type=“text”></input> <input type=“email” name=“email”></input> <button type=“submit” name=“submit”></button> </form> When you run the code, if you don’t write in the email section an email, the page will tell you when you submit “please enter a valid email address” because the type was “email”
28th Aug 2018, 12:08 PM
Elsa Lubek
0
The id is just a way to identify it, you can write whatever you want The “type” is the type of thing it is, for example “textarea” or “email”
28th Aug 2018, 12:02 PM
Elsa Lubek