Lumpy
Lumpy

Reputation: 3652

Cant remove entire draggable

I have an img element that is both draggable and resizeable. I am trying to create a delete button for this element. the delete button is embeded in the draggable container. When I do

$('deleteBtn').parent().remove();

everything goes except the original image. What am i doing wrong.

http://jsfiddle.net/p9PBA/2/

click the image to create the draggable, then the top left black box is the delete.

Edit: Is it possible this has something to do with the static positioning of the img element?

Upvotes: 0

Views: 34

Answers (1)

Rohrbs
Rohrbs

Reputation: 1855

This seems to work:

deleteBtn.click(function(){
    $(this).siblings('img').remove();
    $(this).parent().remove();
});

Upvotes: 2

Related Questions