I learned jquery from 2 week and i'm fairly inexperienced.
...
....
<script>
$(function() {
$("div[id^='amico_']").draggable({ revert: "valid" });
$("#droppable").droppable({
activeClass: "ui-state-hover",
hoverClass: "ui-state-active",
drop: function(event, ui) {
var index = $(".ui-draggable").attr('idAmico');
$(this)
.addClass("ui-state-highlight")
.find("p")
.html("id = " + index);
}
});
});
</script>
the problem is that id attribute's value is always 1 (index variable) while are 1 and 2. (red row)