Re-attaching jQuery detach();

后端 未结 8 1196
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-09 01:42

I have detached a div and want to re-attach it when clicking on a button.

Here\'s the code:

$(\'#wrapper\').detach();

$(\"#open_menu\").click(functi         


        
8条回答
  •  情深已故
    2020-12-09 02:29

    $(function(){
     var detached = $('#element_to_detach').detach();
     // Here We store the detach element to the new variable named detached
     $('.element_after_which_you_need_to_attach').after(detached);
    });
    

提交回复
热议问题