Skip to content

Instantly share code, notes, and snippets.

@temberature
Created April 12, 2019 09:28
Show Gist options
  • Save temberature/54a6c874b6ac86cf200cb3b36fd96959 to your computer and use it in GitHub Desktop.
Save temberature/54a6c874b6ac86cf200cb3b36fd96959 to your computer and use it in GitHub Desktop.
replace <b>text</b> with text
document.querySelectorAll('b').forEach(element=>{
// element.parentNode.replaceChild(document.createTextNode(element.innerText), element)
console.log(element)
if (element.parentNode && element.parentNode.innerText) {
element.parentNode.innerHTML = element.parentNode.innerText
}
}
)
@temberature
Copy link
Author

document.querySelectorAll('b').forEach(element=>{
// element.parentNode.replaceChild(document.createTextNode(element.innerText), element)
console.log(element)
if (element) {
element.replaceWith(element.parentNode.innerText)
}

}
)

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