Skip to content

Instantly share code, notes, and snippets.

@dvdsmpsn
Created October 31, 2022 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvdsmpsn/b2c84cf07009dc527759e8b16ca0c185 to your computer and use it in GitHub Desktop.
Save dvdsmpsn/b2c84cf07009dc527759e8b16ca0c185 to your computer and use it in GitHub Desktop.
// turns `<h1...h4>Hello world</h1..h4>` into `<h1...h4>Hell🎃 w🎃rld</h1..h4>`
// on halloween only
const now = new Date();
const isHalloween = now.getMonth() === 9 && now.getDate() === 31;
if (isHalloween) {
const h = document.querySelectorAll('h1,h2,h3,h4');
h.forEach(i => i.innerHTML = i.innerHTML.replaceAll('o', '🎃'))
}
@dvdsmpsn
Copy link
Author

And for holiday season....

    const h = document.querySelectorAll('h1,h2,h3,h4'); 
    h.forEach(i => i.innerHTML = i.innerHTML.replaceAll('o', '❄️'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment