Hi all,
I'm trying to use simpletip to generate dynamic tooltips from a database. I am working from this example, which works fine. It's using an image name (the image you hover over) as the key to pass to the PHP for querying the database.
$('.exampleselector').simpletip({
content:'<img src=".." alt="loading" style="margin:10px;" />',
onShow: function(){
var param = this.getParent().find('img').attr('src');
this.load('tips.php',{img:param});
}
});
However, in my page I want to us the source div's id (the div that I'm hovering over) as the key and I can't seem to find a way to do it. i.e.
$(".myselector").simpletip({
content:'<img src="..." alt="loading" style="margin:10px;" />',
onShow: function(){
var myvar = this.parent().attr("id");
this.load('tips.php',{value:myvar});
I've looked around various forums to find the right way to get the div ID. I've tried various versions such as getParent().id , closest .... to no avail. I temporarily put in a window.alert to show the myvar result with all the options I tried. Most times I get nothing, the callback doesn't fire, a few times I just get myvar as undefined.
Can any advise the correct format please?
Many thanks
Tony