Tell us what’s happening: I don’t know what am doing wrong, third eye please.
Your code so far
WARNING
The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.
You will need to take an additional step here so the code you wrote presents in an easy to read format.
Please copy/paste all the editor code showing in the challenge from where you just linked.
const targetInputContainer = document.querySelector(`#${entryDropdown.value} .input-container`);
const entryNumber = targetInputContainer.querySelectorAll('input[type="text"]').length;
let HTMLString = ``;
HTMLString = `
<label>Entry ${entryNumber} Name</label>`;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Challenge Information:
Learn Form Validation by Building a Calorie Counter - Step 44
Teller
February 10, 2024, 4:46am
2
Please post your full code so the forum can assist.
function addEntry() {
const targetInputContainer = document.querySelector(#${entryDropdown.value} .input-container);
const entryNumber = targetInputContainer.querySelectorAll(‘input[type=“text”]’).length;
let HTMLString = ``;
HTMLString = <label>Entry ${entryNumber} Name</label>;
}
Teller
February 10, 2024, 5:04am
4
Hi @nikky.princess
You have let HTMLSting = ``;, which isn’t needed as the variable was already declared using the const keyword.
Then you have another HTMLString variable.
Please remove the code not asked for in the instructions, then try again.
To be safe though, copy the the label element, looks great, then reset the step to restore the original code.
Happy coding
function addEntry() {
const targetInputContainer = document.querySelector(`#${entryDropdown.value} .input-container`);
const entryNumber = targetInputContainer.querySelectorAll('input[type="text"]').length;
const HTMLString = ``;
HTMLString = `<label>Entry ${entryNumber} Name</label>`;
}
still am getting this message in my console log “You should have a label element inside your template literal.
Your label element should have the text Entry ${entryNumber} Name.”
Teller
February 10, 2024, 6:54pm
6
Hi @nikky.princess
Your code has two HTMLString variables.
I don’t know what else to do, am stuck here for days now.
I don’t know what else to do, am stuck here for days now.
Teller
February 11, 2024, 7:44pm
9
Post your full code so the forum can assist.
function addEntry() {
const targetInputContainer = document.querySelector(`#${entryDropdown.value} .input-container`);
const entryNumber = targetInputContainer.querySelectorAll('input[type="text"]').length;
HTMLString = `
<label>Entry ${entryNumber} Name</label>`;
}
Teller
February 11, 2024, 8:09pm
11
Dont’ forget to declare the HTMLString with the const keyword.
Happy coding
Thank you just reset the step and its went well.
1 Like
system
Closed
August 12, 2024, 8:20am
13
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.