我无法从用作拖放框的框中获取值。框拖放正确加上我可以用一个值更新一个 div 但我希望将拖动框中的值与我正在拖动的框的值一起添加到 div 中拖动拖动的框超过。这是到目前为止的代码。任何帮助将不胜感激
这是我到目前为止所拥有的,以及指向我正在制作代码的页面的链接
<script>
$(function() {
// make orange boxes draggable
$( ".draggable" ).draggable();
//make blue boxes draggable but also make things mappen when orange box is dropped in it
$( ".droppable" ).draggable().droppable({
drop: function( event, ui ) {
var targetElem = $(this).attr("title");
// update the div at the top of the page with the value of the blue box being dropped on and the orange box being dragged
$('#showstuff').empty();
$('#showstuff').append('' + targetElem + '');
}
});
// when an orange box is dragged away from the blue box append the #showstuff div
$( ".droppable" ).draggable().droppable({
out: function(event, ui) {
$('#showstuff').empty();
$('#showstuff').append('emptied again');
}
});
});
</script>
链接在这里
http://barrysfiles.co.uk/exp/development-bundle/demos/droppable/barrytest2.php