From 700e828f395ca9015e9fe8668bcb06060fa24e68 Mon Sep 17 00:00:00 2001 From: Georgiy Veshchev Date: Thu, 9 Apr 2026 11:09:27 +0300 Subject: [PATCH] solution --- src/scripts/main.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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); +});