diff --git a/src/scripts/main.js b/src/scripts/main.js index a765fdb1d..ce60a9e9a 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1,3 +1,20 @@ 'use strict'; -// write code here +const inputs = document.querySelectorAll('form input'); + +inputs.forEach((input) => { + const inputName = input.name; + + const capitalizedName = + inputName.charAt(0).toUpperCase() + inputName.slice(1); + + input.placeholder = capitalizedName; + + const label = document.createElement('label'); + + label.className = 'field-label'; + label.setAttribute('for', input.id); + label.textContent = inputName; + + input.before(label); +});