Jak zastąpić element div innym w JavaScript
window.onload = function() {
document.getElementById("to_be_replaced").innerHTML = "<span> gdfg </span>";
}
Innocent Iguana
window.onload = function() {
document.getElementById("to_be_replaced").innerHTML = "<span> gdfg </span>";
}
window.onload = function() {
document.getElementByClass("to_be_replaced").innerHTML = document.getElementByClass("replaced").innerHTML;
}
<div class="to_be_replaced">
Lorem ipsum...
</div>
<div class="replaced">
test
</div>
Run code snippetHide results