Skip to content

Commit

Permalink
add backspase
Browse files Browse the repository at this point in the history
  • Loading branch information
Romanov7788 committed Sep 23, 2024
1 parent 8331017 commit 09d7397
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@ forms.forEach((form) => {
label.classList.add('field-label');
label.setAttribute('for', input.id);

label.textContent = capitalizeFirstLetter(input.name);

input.placeholder = capitalizeFirstLetter(input.name);
if (input.name === 'firstName') {
label.textContent = 'First Name';
input.placeholder = 'First Name';
} else if (input.name === 'lastName') {
label.textContent = 'Last Name';
input.placeholder = 'Last Name';
} else {
const formattedName = capitalizeFirstLetter(input.name);

label.textContent = formattedName;
input.placeholder = formattedName;
}

input.parentElement.insertBefore(label, input);
});
Expand Down

0 comments on commit 09d7397

Please sign in to comment.