Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Content of a Qtip

Tags:

jquery

qtip

qtip2

I've read the api docs and forums and am trying to change the content of a tooltip after it's been set initially, however it is not working. What am I doing wrong?

HTML:

<p id="666">tooltip</p>

JQUERY

var qconfig = {
 show: 'mouseover',
 hide: { when: 'mouseout', fixed: true },
 position: { my: 'bottom center', at: 'top center', adjust: {y: 8} },
 style: { classes: 'qtip-light qtip-shadow' }
};

$("#666").qtip($.extend(true, qconfig, { content: { text: "before", title: "title is here" }}));
$("#666").qtip('option', 'content.text', 'after');
$("#666").qtip('api').set('content.text', 'another after');[/code]

I would expect the content of the tooltip to be "after" or "another after" but it remains "before". Help please.

JSFiddle is here: http://jsfiddle.net/Af64c/

like image 818
CMH Avatar asked Sep 10 '13 22:09

CMH


1 Answers

You can change the content like this

$('#666').data('qtip').options.content.text = 'after';

FIDDLE

like image 74
Khawer Zeshan Avatar answered Sep 20 '22 11:09

Khawer Zeshan