Skip to content

Instantly share code, notes, and snippets.

@obfusk
Created September 5, 2023 19:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obfusk/8c5f8ff85cd1e4aa38d73751f8dd2fac to your computer and use it in GitHub Desktop.
Save obfusk/8c5f8ff85cd1e4aa38d73751f8dd2fac to your computer and use it in GitHub Desktop.
replace all but the first h2 with h3 using JS
[...document.getElementsByTagName("h2")].forEach((x, i) => { if (i > 0) { y = document.createElement("h3"); y.innerHTML = x.innerHTML; x.parentNode.replaceChild(y, x) } })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment