SA. SA. - 1 year ago 111
Ajax Question

jQuery plugin Tooltipster giving error for ajax call to load conent

I have the code like below and the error is from instance.content() line. I am loading all the content dynamically and executing below for all href tags.
The error is
Uncaught TypeError: instance.content is not a function
How can I fix this

ex.find("a[href]").each(function (idx, el) {
var el = $(el);
var url = el.prop("href").substring(4);
el.attr("href", "");

content: 'Loading...',
// 'instance' is basically the tooltip. More details in the "Object-oriented Tooltipster" section.
functionBefore: function (instance, helper) {

var $origin = $(helper.origin);

// we set a variable so the data is only loaded once via Ajax, not every time the tooltip opens
if ($'loaded') !== true) {

$.get(url, function (data) {

// call the 'content' method to update the content of our tooltip with the returned data

// to remember that the data has been loaded
$'loaded', true);



Answer Source

Make sure you are using the files of Tooltipster v4. I see no other reason why it wouldn't work with the code you gave us.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download