Tell us what’s happening:
Hi all,
I have added what required from the step 48: the input with the type, placeholder, and id, matching the for attribute from the label element However , it is not correct. I’m thinking it may be about the back-ticks ( ` ), but I am not sure.
<!-- file: index.html -->
/* file: styles.css */
const targetInputContainer = document.querySelector(`#${entryDropdown.value} .input-container`);
const entryNumber = targetInputContainer.querySelectorAll('input[type="text"]').length;
const HTMLString = `
<label for="${entryDropdown.value}-${entryNumber}-name">Entry ${entryNumber} Name</label>`;
<input type="text" placeholder="Name" id="${entryDropdown.value}-${entryNumber}-name"/>;
}
/* file: script.js */
// User Editable Region
function addEntry() {
const targetInputContainer = document.querySelector(`#${entryDropdown.value} .input-container`);
const entryNumber = targetInputContainer.querySelectorAll('input[type="text"]').length;
const HTMLString = `
<label for="${entryDropdown.value}-${entryNumber}-name">Entry ${entryNumber} Name</label>`;
<input type="text" placeholder="Name" id="${entryDropdown.value}-${entryNumber}-name"/>;
}
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Challenge Information:
Learn Form Validation by Building a Calorie Counter - Step 48