DEV Community

Discussion on: The 3 most common DOM selectors

ayabouchiha profile image
Aya Bouchiha Author

Never heard about that, Thank you so much for the information!
Have a nice day!

efpage profile image

Yes, it is a bit strange feature you should not rely on. There is a global variable for every ID - as long as it is not conflicting with something. In the example above, it is conflicting with a variable, there might be ohter names like classnames etc.. In any case you can access the ID with getElementById without those conflicts.