Hands up if you knew you could do this? https://t.co/lzol6a0xN8
— Ben Howdle (@ben_howdle) September 14, 2018
Every HTML element assigned an ID attribute is available as a global JS variable.
I had no idea, or had utterly forgotten, that every DOM element with an id attribute is available as a variable, seemingly plucked from global space and I guess rendering document.getElementById() almost useless- here's the jsbin link from that tweet.
I forget just how "scripty" Javascript is sometimes, and understand its detractors a bit more (though I am not one of them)
No comments:
Post a Comment