Add Div Back After Using Remove() Method On It

Add Div Back After Using Remove() Method On It
0.0 0

#1

Hi folks,

I used the jQuery .remove() method to remove a div when I press the “Off” button, now I want to add it back when I press the “On” button. Unfortunately, I do not know what method to use to achieve this?

Here is my javascript code:

`
$(".state-2").click(function(){
$(".radar-background").remove();
});

Here is my JFiddle: https://jsfiddle.net/MenelikMakonnen/230xtgmb/

`


#2

Read about jQuery show and hide methods.


#3

@randelldawson, thanks so much!! I don’t know why they couldn’t just have .remove() and .add() methods though!


#4

You could use remove and append if you want.


#5

Oh really!? I thought about that but didn’t think it would work…the word “append” just sounded different. Now being that you are so awesomely helpful, can you point me in the right direction for my other problem here: How To Start Count-down Timer When “Start” Button Is Pressed