How to I undo .detach()?

前端 未结 2 1912
梦谈多话
梦谈多话 2021-01-18 18:44

I\'m using JQuery 1.5 and the following code to detach li elements w/ a certain class when a button is clicked. What I want to know is, when that button is clicked again, h

2条回答
  •  清酒与你
    2021-01-18 19:24

    here u can't for loop.

    var demo;
    $('li.type').fadeOut(300, function() {
         demo = $(this).detach();
    });
    
    $('#replace').click(function() {
       $("ul#foo").append(demo);
    });
    

提交回复
热议问题