Ok I dunno why this isn't working. The alert outside the droppable says 0 but the alert inside the droppable says undefined. Anybody have an idea as to why? I want to start keeping a running count to when a person drops an object into the match div. I dont want to define play inside droppable cause it'll reset to 0 every time someone drops the object. Anybody have any idea as to what I'm not doing right?
var play = [];
for (var i = 0; i < 10; i++) {
play[i] = 0;
alert(play[i]);
$('.match').droppable({
greedy: true,
drop: function(event, ui) {
alert(play[i]);
}
});
}
Heres the fiddle Click Here