Reputation: 5421
Since
$(document).ready(function(){
$('.notice').tooltip();
});
doesn't work for me - probably because I am loading the element with the class .notice
dynamically with Ajax - I have tried to go ahead with another way. So this is what I have so far:
$(document.body).on("mouseover", ".notice", function() {
$(this).tooltip();
});
This makes it work but it causes two problems:
The first time when I hover the element, nothing happens (even no error in the console) but the second time when I hover it, tooltip works!
At the second time when I hover the element, I see the tooltip box and the title box. See image bellow.
I appreciate any help!
Upvotes: 1
Views: 399
Reputation: 146
You need to init tooltip when you're creating new ".notice" element.
e.g.
$(document.body).tooltip();
Upvotes: 2
Reputation: 193261
For delegated tooltip functionality you can simply attach handler to parent container, then all inner elements with title attributes will get custom tooltips:
$(document.body).tooltip();
Demo: http://jsfiddle.net/off074wb/
Upvotes: 1