I have a div that i would like to remove via jquery, but it’s not working.
JQUERY:
$("#answerCommentContainer").on("click", ".editComment", function(e){
//other things
removecomment = $(this).siblings('.singleComment'); //.singleComment is what should be removed
removecomment.remove();
});
I chose siblings() because reading from top to bottom .singleComment is first then other stuff then .editcomment
HTML:
<div id='answerCommentContainer'>
<div class='singleComment'><a href = '/profile.php?p=11'>Jim</a></b> $comment[$a]<input type='hidden' value='333' name='hiddenComment' class='hiddenComment'/>
<a href='#' style='color: orange;' class='editComment'><b>Edit</b></a>
<div class='commentBar'>$difference $periods[$j] ago</div></div>
Assuming i understand your question, do this.
Check out the sample and this jsFiddle
Sample
html
jQuery
Update: jsFiddle and sample is updated