Skip to content Skip to sidebar Skip to footer

Remove Respective Image Onclick Of Close Button

I have a one list page with edit column. When he click on edit it will open one edit page with all data which have list of image in thumbnail format. Now I put close icon to all i

Solution 1:

add common class for div and dynamic id also now you have only dynamic id; if you use common class we can write jQuery like this HTML

<divid="<?=$rw['id'];?>"class="common">
  ----elements
</div>

jQuery

jQuery('.common').on('click',function(){
     var element_id=jQuery(this).attr('id'));// u will get dynamic id of div; after that u can do anything by using this id  
 });

Solution 2:

An example fiddle is created. Please check.

Please give a class of remove-img to the remove buttons.

<img class="remove-img" src="url" />

Then you need to remove the parent division on click of the remove image like:

$('.remove-img').click(function(e) {
    $( this ).parent().remove();
}); 

Post a Comment for "Remove Respective Image Onclick Of Close Button"