I have folders with tooltips displaying text like '0 entries' or '5 entries' and so on. I am looking for a way to dynamically update this tooltip number every time an item is added to the folder. The initial count may not always start at zero, and I need each individual drop div to be updated accordingly as I have multiple folders. You can see a working example here: http://jsfiddle.net/4ehSG/3
jQuery
$(document).tooltip();
var dropped = 0;
$(".draggable").draggable();
$(".droppable").droppable({
drop: function(event, ui) {
dropped++;
$(this)
.attr('title', dropped + ' entries')
.addClass("ui-state-highlight")
.find("p")
.html("Dropped!");
$(".draggable").fadeOut();
}
});
HTML
<div class="draggable ui-widget-content">
<p>Drag me to my target</p>
</div>
<div class="droppable ui-widget-header" title='2 entries'>
<p>Drop here</p>
</div>