From 22867da656ff213e8a99a9771b99075b042f0e9b Mon Sep 17 00:00:00 2001 From: Maksym Date: Thu, 9 Apr 2026 14:41:25 +0300 Subject: [PATCH] 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..8e9d7132f 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.htmlFor = input.id; + + label.textContent = + input.name.charAt(0).toUpperCase() + input.name.slice(1); + + input.placeholder = + input.name.charAt(0).toUpperCase() + input.name.slice(1); + + input.parentElement.prepend(label); + }); +});