TAG
JavaScript
Result
Run
License
<button id="btn" type="button">Move</button> <p class="paragraph"> <span>Lorem Ipsum</span> is simply dummy text of the printing and typesetting industry. <span>Lorem Ipsum</span> has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. </p>
window.addEventListener("DOMContentLoaded", () => { let elBtn = document.getElementById('btn'); elBtn.addEventListener("click", () => { let aSpan = document.querySelectorAll(".paragraph > span"); aSpan.forEach(el => { let elReplace = document.createElement("b"); elReplace.textContent = el.textContent; el.replaceWith(elReplace); }); }); });
Console
expand_less
License
License
by DevDic
Close