0

What is the use of name attribute in input element??

25th Nov 2016, 6:42 AM
Dharani
Dharani - avatar
2 odpowiedzi
+ 1
"name" gets submitted to the server once the user presses the submit button so the server can know what kind of data it is
25th Nov 2016, 7:07 AM
coreplo
coreplo  - avatar
+ 1
on the other hand "id" is more useful for the client side since it can be referenced by javascript using getReferenceById() method. A big difference is that you can use the same "name" for multiple elements but "id" must be unique
25th Nov 2016, 7:12 AM
coreplo
coreplo  - avatar