As per requirement, I want to update an existing tipsy title, but it doesn't seem to work.
Situation
HTML:
<ul>
<li id="li1">Point at me (title -> value)</li>
<li id="li2">Point at me (title -> callback)</li>
<li id="li3" original-title="FooBar1">Point at me (title -> html attribute)</li>
</ul>
<button>Click me to update</button>
JS:
$('#li1').tipsy({
title: 'FooBar1'
});
$('#li2').tipsy({
title: function() { return 'FooBar1'; }
});
$('#li3').tipsy();
$('button').click(function() {
alert('Updating tipsy titles');
// Try setting title attribute
$('li1')[0].setAttribute('title', 'FooBar2');
$('li2')[0].setAttribute('title', 'FooBar2');
$('li3')[0].setAttribute('title', 'FooBar2');
// Try setting original-title attribute
$('li1')[0].setAttribute('original-title', 'FooBar2');
$('li2')[0].setAttribute('original-title', 'FooBar2');
$('li3')[0].setAttribute('original-title', 'FooBar2');
});
You can play with this in a jsFiddle: http://jsfiddle.net/TvFmG/3/
Problems
I'm having the following problems:
- Setting the title via
tipsy({title: 'string'})
doesn't seem to work at all. - The tipsy docs suggest that it's possible to update the title value by setting the
original-title
attribute (see section "Dynamically Updating Text"), but that doesn't seem to work in my case (see jsfiddle).
Are the tipsy docs plain wrong, is it some version incompatibility or is it some other issue that prevents this example from working?