diff --git a/src/scripts/main.js b/src/scripts/main.js index a765fdb1d..07dde5976 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'); + +for (const input of inputs) { + const label = document.createElement('label'); + + label.className = 'field-label'; + label.setAttribute('for', input.getAttribute('id')); + label.textContent = input.getAttribute('name'); + + input.before(label); + + const wordsPlaceholder = input.getAttribute('name'); + + input.setAttribute( + 'placeholder', + wordsPlaceholder[0].toUpperCase() + wordsPlaceholder.slice(1), + ); +}