What is happening with these parameters?

I know that we are selecting all elements with the id with breakfast but what is the “input[type=number]”? There is only one input type that is number and that is the input element. Is it trying to say select all elements with a id of breakfast within a input type of number?

This is from Step 67 of “Lean Form Validation by Building a Calorie Counter”

breakfastNumberInputs = document.querySelectorAll("#breakfast input[type=number]");

Hello!

You are right with your guess that the query selector should only refer to inputs with the type of number.

While it seems to be obvious that we only have a number input here: The breakfast id might include a type of “text” or “text field” in a real application, so you practice to be precise in this exercise.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.