From 0b8e02fb6d06b03c90748df96927052409c76c2c Mon Sep 17 00:00:00 2001 From: viviviviviivilll Date: Fri, 30 Oct 2026 00:49:55 +0100 Subject: [PATCH 1/2] Resolved --- src/scripts/main.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/scripts/main.js b/src/scripts/main.js index a765fdb1d..a406ca1dc 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1,3 +1,17 @@ '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.setAttribute('for', input.id); + label.setAttribute('class', 'field-label'); + label.textContent = input.name.toUpperCase(); + + input.setAttribute('placeholder', input.name.charAt(0).toUpperCase() + input.name.slice(1)); + input.parentNode.insertBefore(label, input); + }); +}); From 3a7cb6b22a830d020595caf3d2316f67bf335edb Mon Sep 17 00:00:00 2001 From: viviviviviivilll Date: Fri, 30 Oct 2026 00:59:13 +0100 Subject: [PATCH 2/2] Resolved --- src/scripts/main.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/scripts/main.js b/src/scripts/main.js index a406ca1dc..b0654b89c 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -2,16 +2,20 @@ const forms = document.querySelectorAll('form'); -forms.forEach(form => { - const inputs = form.querySelectorAll('input'); +forms.forEach((form) => { + const inputs = form.querySelectorAll('input'); - inputs.forEach(input => { - const label = document.createElement('label'); - label.setAttribute('for', input.id); - label.setAttribute('class', 'field-label'); - label.textContent = input.name.toUpperCase(); + inputs.forEach((input) => { + const label = document.createElement('label'); - input.setAttribute('placeholder', input.name.charAt(0).toUpperCase() + input.name.slice(1)); - input.parentNode.insertBefore(label, input); - }); + label.setAttribute('for', input.id); + label.setAttribute('class', 'field-label'); + label.textContent = input.name.charAt(0).toUpperCase() + input.name.slice(1); + + input.setAttribute( + 'placeholder', + input.name.charAt(0).toUpperCase() + input.name.slice(1), + ); + input.parentNode.insertBefore(label, input); + }); });