+ 1

[Html5] Understanding how to use Form and Input attributes.

I come from learning C++. So when I see for example: <Input type = "text" name = "First name" /> If I put in a name like "Joe", The NAME of the variable is "First name" The TYPE of the variable is "Text" The VALUE of the variable is "Joe" Right?? So when I need to call a function that does something with the first name, I would need the NAME of the variable "First name" as a parameter for a given function? I also see 'id=' sometimes inside the 'Input' tag. Whats the difference between 'id' and 'name'??? Because on this website, in the HTML5 topics, forms is covered and includes id. I searched and it has something to do the other programming languages?? Any help is greatly appreciated.

13th Mar 2019, 7:05 PM
J3fro C
J3fro C - avatar
2 Respostas
+ 5
Id is to help you to style and do some js, name is for backend, to store some value...
13th Mar 2019, 11:17 PM
PanicS
PanicS - avatar
+ 2
The name is what is submitted to the server when the form is submitted. The id tag would be to do things from within the browser, like using javascript or css.
13th Mar 2019, 7:29 PM
Mike
Mike - avatar