JavaScript: Difference Between GetElementByID and QuerySelector
kiru.io
kiru.io
I would prefer to use valid id's but also, when selecting by id I just use getElementByID?
You could also use querySelectorAll(id) and have more than one element with the same id. It doesn't seem like a good idea.
The linked SO[0] link answers the question: Basically, you can have an id starting with a number, but have to escape them correctly.
I was mostly surprised to learn there is a difference between CSS selectors and the querySelector in Javascript.
That you can hack something up that will accept numbers is no surprise. You could use getAttribute or xpath, I'm sure those will accept numbers too.