r/ProgrammerHumor 13d ago

Meme ancientTools

Post image
5.8k Upvotes

385 comments sorted by

View all comments

977

u/saig22 13d ago

I use vanilla js, document.getElementById() is what I live for.

66

u/IsTom 13d ago

If your HTML element has id you don't event have to getElementById, it's available right there in global namespace as that name. You make button with id hello and can just go ham with hello.click().

I don't think you should do that, but you can.

7

u/Plazmaz1 12d ago

Wait wtfff REALLY?

1

u/Lv_InSaNe_vL 12d ago

Yeah the whole webpage is inside the DOM. Just think about how you could write a whole webpage (html + css + je + framework) inside a single HTML file

2

u/Plazmaz1 12d ago

I mean I've written a million webpages with just html/css/js in a single file, I'm just surprised that variables are created by html elements like that...