santa
santa

Reputation: 12512

Is it possible to use multiple tooltips with this jQuery plugin?

I was looking at the plugin that shows tooltips: http://www.pierrebertet.net/projects/jquery_simpletooltip/

However, I am still not clear whether is it possible to have multiple times different tool tips on the page. For example, I have the following:

$("#tip").simpletooltip({ click: true });

and then

<a id="tip" href="#tooltip_1">some text</a>

hidden layer

<div id="tooltip_1">something here</a>

I've tried adding additional links and tooltips and it does not seem to be working. Is it a bug?

<a id="tip" href="#tooltip_2">some text 2</a>
<a id="tip" href="#tooltip_2">some text 3</a>

<div id="tooltip_2">something here</a>
<div id="tooltip_3">something here</a>

Upvotes: 0

Views: 977

Answers (1)

charliegriefer
charliegriefer

Reputation: 3382

You seem to have multiple elements with the id "tip". Give each element a unique ID, and call .simpletooltip() on each of those elements.

$( '#tip1' ).simpletooltip( { click: true } );
$( '#tip2' ).simpletooltip( { click: true } );

Or, you could assign a class to the elements that you want the tooltip to fire on, and call it on

$( '.myClassName' ).simpletooltip( { click: true } );

Upvotes: 1

Related Questions