How to add div to jquery even if you just used .remove () function

Below is my code that I use to remove the div tag. I also want the script to add the same div tag later when certain conditions are met. The div has some preloaded content that I don't want to lose.

$ ('# wrapper1') remove () ;.

Any help would be greatly appreciated.

Cheers, Vishal

+3
source share
3 answers

.remove(), .hide(), .show(), . .remove() , . , .appendTo(), .show().

+4

- ... , , , .detach(), .remove() ( /):

var wrapper = $('#wrapper1').detach();

:

$("selector").append(wrapper);

/ , , , .

+2

.

$("#wrapper1").hide(), .

$("#wrapper1").show(), , .

+1

Source: https://habr.com/ru/post/1776405/


All Articles