0
Id function
why do I need to use the id attribute
2 Antworten
+ 3
You do not need to use it.
0
Haleluya Tegegne
you can write html without using the id attribute. But it makes selecting elements harder if you want to add Javascript to it. Selecting by id is the easiest way to manipulate DOM elements with Javascript.
You also need id if you want to link one part of your page to another. href="#yourid"
Also, connecting labels with form elements is done through id.
You don't have to add it to every element. Only add it to those that needs it.