I’ve written that piece of code and I would like to know something I’m not really sure about.
When using the querySelector(), I need to give it what I want to select in the brackets, right? In that case above, I realized I can write input[type=number], leaving “number” unquoted.
In CSS and/or HTML I would normally write type="number", with the word quoted. My question is: is that something that can be done both ways and the code will ignore it? Can it be done both ways, quoted and unquoted, and it’ll work either way?
Is it more like a good practice for readability/understanding to write it between quote marks?
In the future, it is best to use the Help button in the step to ask a question here since it will include both your code and a link to the step. But for this post, please tell us which step this is for.
Ahh, I see, perhaps this question doesn’t relate to one specific step. OK, I’ll let it slide this time
But in answer to your question, technically, you only need to use quotes if there is white space in the string. So either type=number or type="number" is fine.
Personally, I always use quotes, even if there is no white space. I think it makes the code easier to read. But I’m sure there are others who think differently.