19 October 20261 min read

Today I learned how to make a Markdown page show a number that dynamically changes, like “I have been alive for 30 years, 5 months, 18 days…”

Imagine a worksheet with this sentence:

I have been in the world for _____.

Markdown lets you drop small pieces of HTML into a normal sentence:

I have been in the world
<span data-age-counter data-birth="1996-05-01">…</span>.

To make it dynamic, a small JavaScript script plays the role of the pencil to write a new answer.

You can see the live counter in action on my about page.

Back to /til→
𖥸
Email Me
Thanks for reading! If you found this page useful, considerbuying me a coffee
No CopyrightCC0 1.0
PREV
NEXT