Randomblue Randomblue - 3 months ago 37
jQuery Question

replaceWith() without deleting the original element

Is there a jQuery function similar to

to replace an element with a new element, without destroying the original element (simply hiding it).


you can do :

<div class="toReplace">your first content</div >
<div class="toReplace" style="display: none">your second content</div >

then in js :

$("button").click(function () {