re: DOM elements with ID's are global variables VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Nicely spotted! Although we're supposed to think of "global" variables as Bad™, I think there's a definite case to be made why this is actually Not...
 

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...

code of conduct - report abuse