Earn-form-validation-by-building-a-calorie-counter - Step 45 : Question about answer

<label for=\"${entryDropdown.value}-\${entryNumber}-name\">Entry \${entryNumber} Name</label>
<label for = "${entryDropdown.value}-${entryNumber}-name">Entry ${entryNumber} Name</label>

My brain is telling me that both of these are perfectly valid HTML tags.

However the lesson only lets you use the one without the spaces. Is there a specific reason to make sure you do not have spaces when making html tags this way?

Please post the link to the step. Thank you

it keeps reverting my edits.

step 46

It is for step 46 sorry not 45. The produced HTML tag i originally had spaces around the = and it would not accept it. Was wondering what was wrong for a good amount of time. Turns out i wasnt supposed to have any spaces around the =. Just wondering why we are required to have no spaces around the = when in an html tag i don’t think the spaces really matter.

<label for="${entryDropdown.value}-${entryNumber}-name">Entry ${entryNumber} Name</label>`;
<label for = "${entryDropdown.value}-${entryNumber}-name">Entry ${entryNumber} Name</label>`;

Top is accepted bottum is not

The comparison in the tests is probably a bit strict. IT is a bit odd to add extra spaces around the =, but its syntactically valid HTML.

1 Like

I find it much easier to read with the spaces which is why I use them. Thank you for clarifying that they are syntactically the same i understand this course is still a beta and literally just went live a few days ago. This is why I am mentioning this so it can be updated in hopes that if someone makes the same mistake I made there can be a prompt to help them out.

Thanks for the super fast responses this forum is pretty amazing.

1 Like

Ok, that’s just not as common of a style.

1 Like

Thanks again Jeremy :slight_smile:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.