this post was submitted on 11 Jul 2024
276 points (95.7% liked)

Programmer Humor

32435 readers
387 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

Meme transcription [Kid drowning in pool]

In the background a person plays with a kid in the pool. The person is labeled “Companies updating their website”. The kid is labeled “The company logo”.

In the foreground a kid seems to be drowning. It is labeled “Useful information”.

In a second panel a skeleton sits at the bottom of the pool. It is labeled “The copyright year”

you are viewing a single comment's thread
view the rest of the comments
[–] konalt@lemmy.world 19 points 4 months ago (2 children)

document.querySelector('span#copyright_year').innerText = new Date().getFullYear()

[–] bleistift2@sopuli.xyz 9 points 4 months ago* (last edited 4 months ago) (1 children)

No need to specify the tag name in the selector if you’re going to use an ID anyway.

[–] FooBarrington@lemmy.world 4 points 4 months ago (1 children)

Right - it should have been:

document.querySelectorAll('span#copyright_year').forEach((el) => { el.innerText = new Date().getFullYear() })

so that we update all spans with that ID!

[–] bleistift2@sopuli.xyz 2 points 4 months ago

So true and yet so hurtful.

[–] stetech@lemmy.world 1 points 3 months ago

<span>&copy; <?php echo date("Y"); echo $companyName ?></span>