How can I remove the entire div when any child image is clicked? Here is my HTML:
<div id="list1">
<img src="FILE1.JPG" class="img">
<img src="FILE2.JPG" class="img">
<img src="FILE3.JPG" class="img">
</div>
<div id="list2">
<img src="FILE4.JPG" class="img">
<img src="FILE5.JPG" class="img">
<img src="FILE6.JPG" class="img">
<img src="FILE7.JPG" class="img">
</div>
Here is the jquery:
$('.img').click(function() {
var $img = $(this);
$.ajax({
url: 'save-image.php?q=' + $(this).attr('id'),
dataType: 'json',
success: function(data) {
$img.closest('div').remove();
}
});
});
I need to run an update script upon an image click, but then I need the entire div to disappear. This code is not working.