Hi there,
I'm creating a little dynamic tooltip function.
Basically if I have a link like so:
<a href="#" data="xyz">?</a>
Using qTip, I attempt to lookup a tooltip table in mysql and retrieve the tip based on the data in the data attribute.
So:
$('a[data]').qtip({
content: {
url: '/tooltip.php',
data: { tipKey: $(this).attr('data') },
method: 'post'
}
});
Problem is, it doesn't work. $(this).attr('data') doesn't seem to pull the value inside the attribute.
If I manually change the function so it looks like the following it works no problem.
$('a[data]').qtip({
content: {
url: '/tooltip.php',
data: { tipKey: 'xyz' },
method: 'post'
}
});
What am I missing when I'm trying to pull the data from the data attribute? Should I be doing something like:
$('a[data]').qtip({
content: {
url: '/tooltip.php',
data: { tipKey: ''+$(this).attr('data')+'' },
method: 'post'
}
});
As that isn't yielding the value either!