temporarily removing and later reinserting a DOM element?

前端 未结 4 1221
囚心锁ツ
囚心锁ツ 2021-02-18 20:25

Is there some jquery magic that will let me do the following:

[0- define some element in HTML (eg, a unchecked checkbox)]

1- update its DOM element by s

4条回答
  •  野性不改
    2021-02-18 20:57

    Six days after the question was answered jQuery released 1.4 which contains the detach method. Which does exactly what you're looking for.

    var detached = $('#element').detach();
    $('body').append(detached);
    

提交回复
热议问题