I have the following jQuery code:
$('a[rel=close]').click(function() {
alert('Close click!');
$('div#purchasePanel').hide();
});
This is used with:
<div id="purchasePanel">
<a href="#close" rel="close"><li> Close </li></a>
</div>
The alert() never gets called.
The DIV contents is shown and displayed using AJAX, which works fine. It’s just this pesky close button that refuses to…
Most likely you are adding the link after registering the handler.
The solution is using a live event: