Tuesday, 17 September 2013

Update number on jQuery UI tooltips

Update number on jQuery UI tooltips

I have folders with tooltips such as '0 entries' or '5 entries' and so on.
I need this tooltip number to update by 1 every time something is dropped
into the folder. Here is the working fiddle http://jsfiddle.net/4ehSG/
jQuery
$(document).tooltip();
$( "#draggable" ).draggable();
$( "#droppable" ).droppable({
drop: function( event, ui ) {
$( this )
.addClass( "ui-state-highlight" )
.find( "p" )
.html( "Dropped!" );
$( "#draggable" ).fadeOut();
}
});
HTML
<div id="draggable" class="ui-widget-content">
<p>Drag me to my target</p>
</div>
<div id="droppable" class="ui-widget-header" title='0 entries'>
<p>Drop here</p>
</div>

No comments:

Post a Comment