This should make the .container
the parent of the draggable:
$('.container').on('drop', function(event, ui) {
$(this).append(ui.draggable);
});
Note: You don't need the "drag" handler then.
Also, your handler for the .test
button isn't showing you what you want, but this will:
$('.test').on('click', function() {
$('.logs').show();
$('.num').each(function() {
var whoseMyDaddy = $(this).parent().attr('class');
$('<p>'+whoseMyDaddy+'</p>').appendTo('.logs');
});
});
The problem is that your code loops four times, but always gets the class of the first .num
element's parent.
And one last thing: It's probably not good to have the containers be <div>
elements when the draggables are <li>
elements.