I am trying to use HTML5 data attributes to store and display content for a tooltip.
I am using jQuery UI for tooltip.
I read the documentation, but did not understand how to program the correct selector and display user data.
Any ideas what I'm missing?
http://jsfiddle.net/QsEJk/2/
HTML:
<span class="info-icon" data-title="custom title" data-desc="custom description"> </span>
JS:
$( '.info-icon' ).tooltip({ content: function() { return 'Title: ' + $( this ).data('title') + ' Description: ' + $( this ).data('desc'); } });
source share