+ 2

What is the difference between input (id) & input (name) ?

in the HTML forms, what is the difference between (ID) & (NAME) attributes in the input element ??

9th May 2020, 6:56 PM
Abdallah
Abdallah - avatar
3 Réponses
0
You can read more here: https://stackoverflow.com/questions/7470268/html-input-name-vs-id Btw. it is great place when you try find some info about problems - solutions. I just start my tour with Angular but I can agree with XXX. Happy coding!
9th May 2020, 7:37 PM
Kuzkam
+ 2
The name attribute is used by the backend. When you submit a form, it is sent to the server as a hash (key-value pairs). The keys are the name attributes and the values are the inputs entered by the user. <input name="username" type="text"> Can be accessed by the server by 'username', i.e. the name attribute. As for id, it used when you are on webpage to access the different things on the webpage and make changes, for example, in CSS, "#username" will select a tag with an id "username"
9th May 2020, 7:02 PM
XXX
XXX - avatar
+ 1
You may find answer in :- 1) https://www.tutorialspoint.com/What-is-the-difference-between-id-and-name-attributes-in-HTML 2) https://www.google.com/search?q=input(id)+vs+input(name)&rlz=1C9BKJA_enUS705US705&oq=input(id)+vs+input(name)&aqs=chrome..69i57j0.62080j0j4&hl=en-US&sourceid=chrome-mobile&ie=UTF-8
10th May 2020, 3:32 PM
narayanaprasad
narayanaprasad - avatar