Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to show current year in the intro text #88

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from

Conversation

maeriens
Copy link

@maeriens maeriens commented Jan 7, 2019

This is to show the current year, addressing issue #68

I have literally no idea how I managed it, I simply copied more or less how the data was being replaced in the 2nd slide. I guess that's what people call programming.

@nerdius
Copy link

nerdius commented Sep 14, 2019

A better approach would be using a <span> with an unique ID, then selecting that from JavaScript and assigning a value to its innerHTML. There's also no need to have a function at all.

Here's the code:

HTML:

Meanwhile: it's <span id="current-year"></span>, the West has been at peace for decades, and

JavaScript:

document.querySelector('#current-year').innerHTML = new Date().getFullYear();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants