Why won't this DOM element disappear?

Posted by George Edison on Stack Overflow See other posts from Stack Overflow or by George Edison
Published on 2010-03-13T01:46:52Z Indexed on 2010/03/13 1:57 UTC
Read the original article Hit count: 439

Filed under:
|
|

I have a page that uses jQuery with a small glitch.

I managed to get this down to a simple example that demonstrates the problem:

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">

function hideIt()
{
    $('#hideme').fadeOut('slow', function() { $(this).remove(); } );
}

</script>
</head>
<body>
<div id='#hideme'>Hide me!</div>
<button onclick='hideIt();'>Hide</button>
</body>
</html>

As you would expect, the problem is simple: the caption doesn't disappear.

What simple thing did I overlook? (Or if it's not a simple thing, what complicated thing did I miss?)

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about hide