I have an HTML page that uses jQuery and also have an external plugin tooltipster.
In order to intialize the plugin I have to do this:
$(document).ready(function() {
$('.tooltip').tooltipster();
});
The HTML is very simple you just have to set the class to "tootlip":
'<span class="tooltip" title="This is my spans tooltip message!">Some other text</span>'
This works great for static elements in the DOM.
The problem comes for new elements added after the DOM is created.
This is similar to jQuery when using .on() or .live() for elements created after.
So If I have:
$('#newelement').click(function(e) {
$('#elements').html('<span class="tooltip" title="This is my spans tooltip message!">New element</span>');
});
Any clue on how to make this work? Can I use
.on()in a way that it works for static and dynamic elements?
