Re:Named element IDs can be referenced as JavaScript globals
by FrontAid on Tuesday September 27, 2022 @11:26AM
(#32996567)
The article already explains that thoroughly.
Re:Named element IDs can be referenced as JavaScript globals
by pmoleri on Tuesday September 27, 2022 @12:55PM
(#32997952)
Nice article, thanks for sharing it.
Re:Named element IDs can be referenced as JavaScript globals
by genezeta on Tuesday September 27, 2022 @11:18AM
(#32996439)
It's has been explained enough times. It's just that looking things up for yourself seems to have gone out of fashion.
Re:Named element IDs can be referenced as JavaScript globals
by spookthesunset on Tuesday September 27, 2022 @11:24AM
(#32996548)
That doesn’t help people who stumble upon this when searching for the problem. All the “look it up” response does is make sure the search results are a bunch of content saying “look it up”, which isn’t really that helpful.
Re:Named element IDs can be referenced as JavaScript globals
by llanowarelves on Tuesday September 27, 2022 @11:33AM
(#32996689)
That's a classic.
Get my hopes up finding an old forum post asking my question, hoping to find answers. All the answers are "use Google/etc", which is how I got there.
Re:Named element IDs can be referenced as JavaScript globals
by nkozyra on Tuesday September 27, 2022 @12:05PM
(#32997206)
It is explained fairly early in the article.
This used to be done quite a lot in the early JS days when scope was kind of thrown out the window (no pun) and you just did whatever dirty thing you needed to in order to make a page work.
Re:Named element IDs can be referenced as JavaScript globals
by pierrec on Tuesday September 27, 2022 @11:33AM
(#32996694)
lol, I just searched "problem with referencing named element ids as javascript globals": the first result is the linked article and the second result is, you guessed it, this thread with your comment on top.
Re:Named element IDs can be referenced as JavaScript globals
by scratcheee on Tuesday September 27, 2022 @12:08PM
(#32997252)
>the person writing about the new discovered weird trick almost always fails to precede the article with a big, red, bold "Please don't ever do this"
> It's has been explained enough times. It's just that looking things up for yourself seems to have gone out of fashion.
It appears you've countered your own complaint.
https://wikipedia.org/wiki/Wikipedia:Chesterton's_fence