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