May be , you should choose the suitable libraries: JS+CSS for jquery UI.
See this fiddle . it works. http://jsfiddle.net/abdennour/67SrS/
var itemsInPosition = 0;
var totalItems = 4;
var totalCorrect = 0;
$('.drag-me').draggable({revert:"invalid", snap:".target"});
$('.target').droppable({
drop: function( event, ui ) {
itemsInPosition++;
// get id of draggable and droppable id
var draggableID = $(ui.draggable).attr("id");
var droppableID = $(this).attr("id");
if(draggableID[4]==droppableID[6]){
alert("correct")
testIfComplete();
totalCorrect++;
}
}
});
and you can conclude& download the suitables libraries from this fiddle :
http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/overcast/jquery-ui.css