In the explanation of Adding a Label, we found <input type=“text” name=“x” id=“x”>. In the explanation of Password Input, we found <input type=“password” id=“x” name=“x”>. While in “Number Input,” we found <input id=“x” name=“x” type=“number” step=“x”>
My question is, why in Adding a Label, the name attribute comes before the id attribute, different from in Password Input which the name attribute comes after the id attribute and also their structure of the use type, name, id different from the Number Input structure?
Hi,
Although I understand that the attribute order is irrelevant in terms of execution order and rendering on the HTML page. Yet in previous lessons we are taught about readability of the code and common practice. Surely there is some guideline on the order of attributes ? Or at least an order to agree on.
Type / Name / ID / etc ?
yes, unfortunately, there is no guidance, so you choice your own order if you work alone, or choice an order for the attributes when working in a team and then sticking to them
After reading through the comments I understand the the attributes and values perfectly fine, as well as per the comments that the order does not matter, why doesn’t the lesson make this clear and marks us wrong if we follow the example to put “type / id / name” in that order instead of the “id / type / name”?
Hello,
So I also had this question due to my answer being counted wrong and I was wondering if anyone could let me know if it is just a bug or am I actually doing something wrong?