2

How do you refresh the beauty tips plugin? I'm trying to change beauty tips applied to an element when on a click event. I would be happy either

  1. disabling the beauty tip for that element when it is clicked or

  2. changing the content of the beauty tip when it is clicked.

It seems like I can change the "options" array no problem, but it doesn't reflect that change in the beauty tip.

ctrygstad
  • 131
  • 1
  • 3
  • 11

2 Answers2

1

I had the same problem recently; in my case I needed to update a tooltip on the parent element of a select whenever the selection changed (with the tooltip contents based on the title element of the selected option). To get the tooltip to update on an element, i.e. to get its contents to change, you need to:

  1. remove the attribute that BT uses to store the original title (so that it doesn't think it's already handled the element),

  2. set the element's title attribute to the new content you wish to display in the updated tooltip,

  3. call the bt() function again to create the updated tooltip.

For instance:

element.removeAttr('bt-xtitle');
element.attr('title', 'new tooltip content');
element.bt();

Obviously this assumes that you're using the default title attribute to generate the content, if you're using a custom contentSelector like a div, you'll need to adjust the code accordingly but the concept should remain the same.

Hopefully this can help someone trying to achieve the same thing, since it's not very intuitive how to do this.

Amos M. Carpenter
  • 4,848
  • 4
  • 42
  • 72
1

To disable BT on an element, use this syntax:

$('selector').btOff(); 

To re-enable BT use:

$('selector').btOn();
Mitch A
  • 2,050
  • 1
  • 21
  • 41
  • The `btOn()` and `btOff()` functions only show and hide the tooltip, respectively. The OP was asking for a way to refresh its contents. – Amos M. Carpenter Nov 01 '12 at 09:13