Closed Tolia closed 10 years ago
Did by analogy jquery
The .replaceWith() method removes content from the DOM and inserts new content in its place with a single call. Consider this DOM structure:
.replaceWith()
<nav> <a class="first" href="#first">first</a> <a class="second" href="#second">second</a> </nav>
The second element could be replaced with new element
newEl = jBone('<b>second<b>') jBone('.second').replaceWith(newEl)
This results in the structure:
<nav> <a class="first" href="#first">first</a> <b>second<b> </nav>
replaceWith works with jBone and with DOM elements
replaceWith
Did by analogy jquery
The
.replaceWith()
method removes content from the DOM and inserts new content in its place with a single call. Consider this DOM structure:The second element could be replaced with new element
This results in the structure:
replaceWith
works with jBone and with DOM elements