Skip to content

Commit

Permalink
add space in namePlaceholder
Browse files Browse the repository at this point in the history
  • Loading branch information
TSkuratovska committed Sep 30, 2024
1 parent 400a01e commit 2f55c2f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
const allInput = document.querySelectorAll('form input');

allInput.forEach((input) => {
input.placeholder = `${input.name.charAt(0).toUpperCase() + input.name.slice(1)}`;
const formatPlaceholder = (inputName) => {
return inputName.replace(/([A-Z])/g, ' $1').trim();
};

input.placeholder = formatPlaceholder(
input.name.charAt(0).toUpperCase() + input.name.slice(1),
);

const newLabel = document.createElement('label');

Expand Down

0 comments on commit 2f55c2f

Please sign in to comment.