diff --git a/src/scripts/main.js b/src/scripts/main.js index a765fdb1d..9e6f3474a 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1,3 +1,19 @@ 'use strict'; -// write code here + let inputElements = document.querySelectorAll('form .field .field-text'); + + let m = Array.from(inputElements); + + m.forEach((el) => { + let inputName = el.getAttribute('name'); + let inputId = el.getAttribute('id'); + + inputName = inputName[0].toUpperCase() + inputName.slice(1); + el.setAttribute('placeholder', inputName); + const label = document.createElement('label'); + label.className = 'field-label'; + label.htmlFor = inputId; + label.textContent = inputName; + + el.before(label); + });