Skip to content
Open
Changes from 1 commit
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
12 changes: 11 additions & 1 deletion src/scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
'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.

According to the task description, you should get all input elements from the form tag. This selector will get all input elements on the entire page, which might not be what is intended. Consider making the selector more specific.


inputs.forEach((input) => {
const label = document.createElement('label');

label.classList.add('field-label');
label.setAttribute('for', input.id);
input.placeholder = input.name[0].toLocaleUpperCase() + input.name.slice(1);
input.parentElement.append(label);
label.textContent = input.name.toLocaleUpperCase();
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 task's expected result image shows capitalized labels (e.g., "Email"), not fully uppercase ones (e.g., "EMAIL"). The textContent for the label should probably have the same capitalization as the placeholder.

});
Loading