Cas*_*ynn 2 jquery jquery-ui draggable jquery-selectors jquery-callback
$('#drop_area').droppable({
accept: '.draggable',
drop: on_element_drop
});
function on_element_drop(event, ui){
}
<div class="draggable">
<img src="test.png" alt="3">
</div>
Run Code Online (Sandbox Code Playgroud)
我试图找出如何从传递给'on_element_drop'的'ui'参数中获取此可拖动div中图像的'alt'属性.有人知道怎么做吗?
我最接近的是:
ui.helper.context.children[0].attr('alt');
Run Code Online (Sandbox Code Playgroud)
但这不起作用.