jQuery replaceWith find new element December 11, 2023 by Tarik $.fn.replaceWithPush = function(a) { var $a = $(a); this.replaceWith($a); return $a; }; See a working demo