From 54df2176fb8134be53c74ad497b79f8311528900 Mon Sep 17 00:00:00 2001 From: Rostyslav Date: Fri, 8 May 2026 23:50:58 +0300 Subject: [PATCH 1/6] Solution --- src/scripts/main.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/scripts/main.js b/src/scripts/main.js index a765fdb1d..1bcd8f53b 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1,3 +1,15 @@ 'use strict'; -// write code here +const inputs = [...document.querySelectorAll('input')]; + +inputs.forEach((e) => { + const label = document.createElement('label'); + + label.classList.add('field-label'); + label.setAttribute('htmlFor', `${e.id}`); + label.textContent = e.name.toUpperCase(); + + e.setAttribute('placeholder', `${e.name}`); + + e.before(label); +}); From fc8d50631f3fc76730baba88cb38e434f13022cd Mon Sep 17 00:00:00 2001 From: Rostyslav Date: Fri, 8 May 2026 23:56:19 +0300 Subject: [PATCH 2/6] Solution --- src/scripts/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/main.js b/src/scripts/main.js index 1bcd8f53b..9393ca1e4 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1,13 +1,13 @@ 'use strict'; -const inputs = [...document.querySelectorAll('input')]; +const inputs = [...document.querySelector('form').querySelectorAll('input')]; inputs.forEach((e) => { const label = document.createElement('label'); label.classList.add('field-label'); label.setAttribute('htmlFor', `${e.id}`); - label.textContent = e.name.toUpperCase(); + label.textContent = e.name.charAt(0).toUpperCase() + e.name.slice(1); e.setAttribute('placeholder', `${e.name}`); From 55ea6fc1a7c37e0b97e56c8dc3491411d12f64de Mon Sep 17 00:00:00 2001 From: Rostyslav Date: Fri, 8 May 2026 23:59:07 +0300 Subject: [PATCH 3/6] Solution --- src/scripts/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/main.js b/src/scripts/main.js index 9393ca1e4..3f454c28c 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1,6 +1,6 @@ 'use strict'; -const inputs = [...document.querySelector('form').querySelectorAll('input')]; +const inputs = [...document.querySelectorAll('input')]; inputs.forEach((e) => { const label = document.createElement('label'); From b502be5f5fc252cbe4a08fb32239e67e03fb1ab2 Mon Sep 17 00:00:00 2001 From: Rostyslav Date: Sat, 9 May 2026 00:05:35 +0300 Subject: [PATCH 4/6] Solution --- src/scripts/main.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/scripts/main.js b/src/scripts/main.js index 3f454c28c..0aaf3b38a 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1,15 +1,18 @@ 'use strict'; -const inputs = [...document.querySelectorAll('input')]; +const inputs = [...document.querySelector('form').querySelectorAll('input')]; inputs.forEach((e) => { const label = document.createElement('label'); label.classList.add('field-label'); label.setAttribute('htmlFor', `${e.id}`); - label.textContent = e.name.charAt(0).toUpperCase() + e.name.slice(1); - e.setAttribute('placeholder', `${e.name}`); + const capitalizedName = e.name.charAt(0).toUpperCase() + e.name.slice(1); + + label.textContent = capitalizedName; + + e.setAttribute('placeholder', `${capitalizedName}`); e.before(label); }); From 6325f02057746b53a85ef295ba751264d0193c05 Mon Sep 17 00:00:00 2001 From: Rostyslav Date: Sat, 9 May 2026 00:11:20 +0300 Subject: [PATCH 5/6] Solution --- src/scripts/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/main.js b/src/scripts/main.js index 0aaf3b38a..cc00bad25 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -6,7 +6,7 @@ inputs.forEach((e) => { const label = document.createElement('label'); label.classList.add('field-label'); - label.setAttribute('htmlFor', `${e.id}`); + label.setAttribute('for', `${e.id}`); const capitalizedName = e.name.charAt(0).toUpperCase() + e.name.slice(1); From 1d14083204267a2649eb8ac45d15547b1e6e0c3f Mon Sep 17 00:00:00 2001 From: Rostyslav Date: Sat, 9 May 2026 00:30:42 +0300 Subject: [PATCH 6/6] Solution --- src/scripts/main.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/scripts/main.js b/src/scripts/main.js index cc00bad25..dfea3a9b6 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1,18 +1,21 @@ 'use strict'; -const inputs = [...document.querySelector('form').querySelectorAll('input')]; +const forms = [...document.querySelectorAll('form')]; -inputs.forEach((e) => { - const label = document.createElement('label'); +forms.forEach((e) => { + const inputs = [...e.querySelectorAll('input')]; - label.classList.add('field-label'); - label.setAttribute('for', `${e.id}`); + inputs.forEach((i) => { + const label = document.createElement('label'); - const capitalizedName = e.name.charAt(0).toUpperCase() + e.name.slice(1); + label.classList.add('field-label'); + label.setAttribute('for', `${i.id}`); - label.textContent = capitalizedName; + const capitalizedName = i.name.charAt(0).toUpperCase() + i.name.slice(1); - e.setAttribute('placeholder', `${capitalizedName}`); + label.textContent = capitalizedName; + i.placeholder = capitalizedName; - e.before(label); + i.before(label); + }); });