Say I have two node references in variables nodeA and nodeB. I would like to mutually replace them with each other in DOM, keeping their all attributes and attached event handlers etc.
How can I accomplish this with jQuery? I tried .replaceWith(...) but as I see it works with html text, and I would like to keep the DOM object itself.
There will be two .replaceWith(...) call. And the second one is on a node, which is not in the DOM... It seems not working...
Thanks in advance