Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
'use strict';

// write code here
const inputs = [...document.querySelectorAll('input')];
Copy link
Copy Markdown

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 form tag, not from the entire document. Use document.querySelector('form').querySelectorAll('input') or form.querySelectorAll('input').

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The selection should be scoped to the form element. Use document.querySelector('form').querySelectorAll('input') instead to select only inputs within the form tag as required by checklist item #1.


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}`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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);
});
Loading