DEV Community

Discussion on: DOM elements with ID's are global variables

Collapse
 
stephenhand profile image
Stephen Hand

Dom elements referenced by ID are global variables and have the same drawbacks as other global variables. I've seen more than supposedly 'reuseable component' break as soon as you tried to add a second instance of it to a page because it's referencing its internal DOM elements by ID...