I want to remove a div by clicking other div.
For example by clicking anywhere in the close div, i want to remove the content div. Here’s what I’m trying and not working:
HTML:
<div id="close">close</div>
<div id="content">content</div>
jQuery:
$('#close').click(function () {
$('#content').fadeOut(200, function () { $(this).remove()})
});
Error:
SyntaxError: syntax error
void;
JSFiddle:
http://jsfiddle.net/p6qrB/
There is nothing wrong with your code. You just forgot to include jQuery in your fiddle: http://jsfiddle.net/p6qrB/1/