diff --git a/src/scripts/main.js b/src/scripts/main.js index 3be83ef9..d1bc315d 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -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');