**I've created the video layout like the pip mode option
refer link -> https://codepen.io/Kathara/pen/poLmwmW
and then I want to detect and swap to append the element before removing the video element tag.**
I've tried this code, and I'm Using DomNodeRemoved
Note: without the use of append and appendTo Method
// After Swapping removed PipMode
$(".video-list ").on('DOMNodeRemoved', function (e) {
if ($('.video-list .videoWrap').length > 0 && $('.mainVideo').length > 0) {
var $AfterthisVideo = $(this).find('video')[0];
console.log("this", $AfterthisVideo)
var $AftermainVideo = $('.main-videoWrap').find('video')[0];
console.log("main", $AftermainVideo)
AfterSwap($AfterthisVideo, $AftermainVideo)
}
});
function AfterSwap(AfterthisVideo, AftermainVideo) {
AfterthisVideo.insertBefore(AftermainVideo, AfterthisVideo)
}
}