-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution #1472
base: master
Are you sure you want to change the base?
Solution #1472
Conversation
i-melnyk
commented
Mar 2, 2025
- DEMO LINK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your implementation in main.js
is well done and meets the task requirements effectively! 🎉 You've dynamically created and inserted labels for input elements, ensuring that the labels are correctly associated with their respective inputs. While everything functions as expected, consider ensuring that each input element has a unique id
attribute to avoid any potential issues. Additionally, using a more specific selector could help target only the intended input elements, enhancing the precision of your code. Keep up the great work and continue refining your skills! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
@@ -1,3 +1,15 @@ | |||
'use strict'; | |||
|
|||
// write code here | |||
const inputEl = document.querySelectorAll('input'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using a more specific selector if you only want to target certain input elements. Using 'input' will select all input elements on the page, which might not be the intended behavior.
const label = document.createElement('label'); | ||
|
||
label.classList.add('field-label'); | ||
label.setAttribute('for', x.id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that each input element has a unique 'id' attribute. The 'for' attribute of the label should match the 'id' of the input element it is labeling. If any input elements lack an 'id', this could lead to issues.