Tell us what’s happening: Instructions have too much wordiness and make absolutely no sense. I don’t even know where to begin. A beginner such as myself with zero experience can’t pull answers from my hat. Give step-by-step instructions please. Stop with the implied instructions. Beginners don’t know the vocabulary/terminology etc.
Your code so far
NONE!!!
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.
Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Challenge Information:
Learn Form Validation by Building a Calorie Counter - Step 37
Ya, this is hard stuff. 50% of programming is understanding what you need to do before you can actually write the code to do it. As you do more of this you’ll realize that you spend just as much time sitting at your computer thinking about things as you do actually writing code. So you are not alone here.
Let’s see if we can break down the problem a little.
“Remember that you queried that dropdown earlier in your JavaScript and assigned it to the entryDropdown button.”
Does this make sense? Do you see in the code that you have already written where you did this?
“Use concatenation to add a # to the beginning of the value property of entryDropdown”
Concatenation here means to add two strings together. The first string is “#” and the second string can be found in the value property of entryDropdown. Do you know how to access the value property of entryDropdown? What might not be clear is why entryDropdown has a value property. It’s a feature of being a select element. To get the currently selected value of the select element with JS, you access the value property.
“assign that result to a targetId variable.”
You want to assign the result of the string concatenation above to the variable targetId. Hopefully you’ve created and initialized enough variables by now to know how to do this.
I hope this helps break it down for you. Please let us know if you have any question.
I tried this solution but I’m still getting stuck on the “value” concept:
function addEntry() {
const entryDropdown = ‘#’ + ‘entry-dropdown’;
const targetID = ‘#entryDropdown’;
}
Ok I figured it out but I think the question could be worded differently. I don’t think we were previously introduced to the value property so short of googling it we wouldn’t know how to apply it from the current directions.
We previously learned about values in the “Key-Value pairs” context, I don’t remember anything about " .value" and it’s use. @freeCodeCamp
@shahidbeigh4 I have added the [spoiler] tags around your solution so someone stumbling upon this thread trying to figure it out won’t accidentally see it.