Created
April 10, 2025 16:48
-
-
Save amberhinds/8f66e91106a97f9f5e66270b8930c3c0 to your computer and use it in GitHub Desktop.
Change a H5 with a specific ID to an H2 instead
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the <h5> element with the ID #plugin-block-heading1 | |
const h5Element = document.getElementById('plugin-block-heading1'); | |
if (h5Element) { | |
// Create a new <h2> element | |
const h2 = document.createElement('h2'); | |
// Copy the content of the <h5> to the <h2> | |
h2.innerHTML = h5Element.innerHTML; | |
// Replace the <h5> element with the new <h2> element | |
h5Element.parentNode.replaceChild(h2, h5Element); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment