From 1597fe1b43255759d29d761949df8630161d05ba Mon Sep 17 00:00:00 2001 From: Alibobick Date: Thu, 30 Apr 2026 14:23:12 +0300 Subject: [PATCH] add task solution --- src/scripts/main.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/scripts/main.js b/src/scripts/main.js index a765fdb1d..4e39f1990 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1,3 +1,22 @@ 'use strict'; -// write code here +const forms = document.querySelectorAll('form'); + +forms.forEach((form) => { + const inputs = form.querySelectorAll('input'); + + inputs.forEach((input) => { + const label = document.createElement('label'); + + label.classList.add('field-label'); + + label.setAttribute('for', input.id); + + label.textContent = input.name; + + input.placeholder = + input.name.charAt(0).toUpperCase() + input.name.slice(1); + + input.parentElement.appendChild(label); + }); +});