删除可拖动对象jquery ui

我有可拖动的对象,如何添加删除按钮来删除此对象?

假设一些HTML结构如下..

.draggable-container { position:relative; } .close { position:absolute; left:10px; top:10px; cursor:pointer; } $('.draggable-container .close').click(function(){ //implement close here // eg: $(this).closest('.draggable-container').fadeOut(); });

举个例子:

 $().append('
close
'); $('.close',
).click(function() { $(this).parent().remove(); });