Tell us what’s happening:
Step 47 of “Calorie Counter” says:
“Inside your template literal, create a label element and give it the text Entry # Name. Using your template literal syntax, replace # with the value of entryNumber.”
My code:
function addEntry() {
const entryNumber = document.querySelectorAll(‘input[type=“text”]’).length + 1;
const HTMLString = <label>Entry ${entryNumber} Name</label>
;
}
Error:
“You should have a label element inside your template literal.”
Any help?
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const entryNumber = document.querySelectorAll('input[type="text"]').length;
const HTMLString = `<label>Entry {entryNumber} Name</label>`;
// User Editable Region
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15
Challenge Information:
Learn Form Validation by Building a Calorie Counter - Step 47