I have a div <div id="maindiv"></div> and some checkboxes to add some html element inside that maindiv.
When i check that checkbox, i need to append <div id="subdiv"></div> after checking that it doesn't contains that element. The subdiv id will vary according to the checkbox selected.
When i uncheck the checkbox, i need to remove the <div id="subdiv"></div> if exists.
How can i do it using jquery?