I need to fade out the parent ‘content’ div when clicking on either of the hyperlinks with the ‘dc’ class. The following code is what I already have, but does not work.
<script>
$('.dc').unbind("click").click(function(){
var dic = this.id;
var strlinkc = "somepage.php?cid=" + dic;
$.post(strlinkc, function(data, textStatus){
$('a.dc#'+dic).closest('.content').fadeOut("slow");
});
});
</script>
<div class="content">
<div id="somediv"><a class="dc" id="23" href="javascript:void(0);">update</a></div>
<div id="anotherdiv">
blah blah blah more text and images
</div>
<div id="yetanother"><a class="dc" id="23" href="javascript:void(0);">update</a></div>
</div>
Put your code in dom ready handler.