Learn Form Validation by Building a Calorie Counter - Step 94

Tell us what’s happening:

The tutor prompt for this says to use the budgetNumberInput element and set the value to an empty string.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

function clearForm() {
  const inputContainers = Array.from(document.querySelectorAll('.input-container'));

  for (const container of inputContainers) {
    container.innerHTML = '';
    
  }
   const budget = "";

}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 94

Hello kingchoffy,

What you have done here const budget = ""; is make a new constant variable, that has an empty string assigned.

The question doesn’t, however, want you to make a new variable. But wants you to set the value property of budgetNumberInput to an empty string.

Remember the budgetNumberInput is created and initialised at the top of the code, and got the element with the id “budget” this element has a value property that you have to reassign.

ohh you mean like this: budgetNumberInput.value = " emptystring";

Hi @kingchoffy

You had the empty string part correct in your original post.
Only the variable needed updating.

If you placing anything between the quote marks then it is not an empty string.

Happy coding

Yes, i just had something in there to be clear on what to do. i have got this sorted so far. Thank you so much.

2 Likes