Question: am trying to remove a div inserted by jquery onclick. for some reason its just not working i tried remove(); hide(); css(); empty(); they all are just not working.. so here's my js function

```
function callme()
{
var content = '<div id="floating_box" class="fb">'
'sdfsdfsdfsdfsfsddsfsfsdfsdfsdfsfsdfsdfsdfsfsdfsd'
'</div>';
jQuery('body.floating_box').empty();
jQuery('body').append(content);
}

```

and here is my html code

```
<div id="notify" class="nn" onclick="callme()">
 <span id="nbox" class="nb">
<img src="gn16.png">
<span id="ntext" class="nt">23</span>
</span>
</div>

```

Answer: 
[demo](http://fiddle.jshell.net/3y7Cz/show/light/)
==================================================

```
function callme()
{
    var content = '<div id="floating_box" class="fb">' +
    'sdfsdfsdfsdfsfsddsfsfsdfsdfsdfsfsdfsdfsdfsfsdfsd' +
    '</div>';
    jQuery('#floating_box').toggle();
    if (!$('#floating_box').length)
      jQuery('body').append(content);
}

```
You are not seeing the floating\_box being removed because a new version of the floating\_box div is added whenever you call the callme function.

```
 function callme() {
     var $floatingbox = jQuery("#floating_box");
     if ( $floatingbox.length ) {
         $floatingbox.remove();
     }
     else {
        var content = '<div id="floating_box" class="fb">' +
            'sdfsdfsdfsdfsfsddsfsfsdfsdfsdfsfsdfsdfsdfsfsdfsd' +
            '</div>';  
        jQuery('body').append(content);  
     }
 }

```

This will check whether the floating\_box div exists, and remove it otherwise add it.