Skip to content

add task solution#1861

Open
timurradkevic wants to merge 2 commits intomate-academy:masterfrom
timurradkevic:develop
Open

add task solution#1861
timurradkevic wants to merge 2 commits intomate-academy:masterfrom
timurradkevic:develop

Conversation

@timurradkevic
Copy link
Copy Markdown

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Great job on this task! You've correctly created the labels and placeholders, and the overall logic for iterating through the inputs is solid. However, some changes are needed because the labels are not being correctly linked to their inputs, which is a core requirement. In JavaScript, for is a reserved keyword, so you cannot use it as a property name. To set the for attribute on a label, you must use the htmlFor property: label.htmlFor = input.id;. Also, to be more precise and meet the task requirements, please update your selector to get only inputs within the form by using document.querySelectorAll('form input'). After these fixes, your solution will be ready!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/scripts/main.js Outdated
'use strict';

// write code here
const inputs = [...document.querySelectorAll('input')];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task asks to get all input elements from the form tag. This selector gets all inputs on the page, regardless of whether they are in a form. To be more precise and adhere to the requirement, consider using document.querySelectorAll('form input').

Comment thread src/scripts/main.js Outdated
const label = document.createElement('label');

label.className = 'field-label';
label.for = input.id;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because for is a reserved keyword in JavaScript, you cannot use it as a property name to set the for attribute. Instead, you should use the htmlFor property: label.htmlFor = input.id;.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Excellent work on this task! You've successfully addressed all the feedback from the previous review. The code now correctly uses htmlFor to link labels to inputs and precisely selects only the inputs within the form. Your solution is clean, efficient, and fully meets all the requirements. I am happy to approve your submission. Great job!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants