-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Solution #1878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Solution #1878
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,15 @@ | ||
| 'use strict'; | ||
|
|
||
| // write code here | ||
| const inputs = [...document.querySelectorAll('input')]; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The selection should be scoped to the form element. Use |
||
|
|
||
| inputs.forEach((e) => { | ||
| const label = document.createElement('label'); | ||
|
|
||
| label.classList.add('field-label'); | ||
| label.setAttribute('htmlFor', `${e.id}`); | ||
| label.textContent = e.name.charAt(0).toUpperCase() + e.name.slice(1); | ||
|
|
||
| e.setAttribute('placeholder', `${e.name}`); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The placeholder should capitalize only the first letter (e.g., 'Email'), not convert all letters to uppercase. Use a method that capitalizes only the first character while keeping the rest lowercase. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The placeholder text is not capitalized. According to checklist item #6, placeholder text should be capitalized (e.g., 'Email' not 'email'). Apply the same capitalization logic used for the label text on line 10. |
||
|
|
||
| e.before(label); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The requirement specifies getting inputs from the
formtag, not from the entire document. Usedocument.querySelector('form').querySelectorAll('input')orform.querySelectorAll('input').