aron
aron

Reputation: 2886

Add Tooltips to helper html.dropdownlist in asp.net mvc

I have a dropdownlist that displays just products codes 101,102,103

If the user hovers over a product code I would like the title to appear as a tooltip.

So it's not your normal DataValue & DataText scenerio, because "101" would be both the display text & the value.

I believe I will need to use jQuery to achive this effect. And I also believe I would need to set the Title attribute of each list item as the Product Title.

My question is, using helper html.dropdownlist how can I set the title attribute?

Thanks, this is my first day using MVC

Upvotes: 0

Views: 1968

Answers (1)

Josh
Josh

Reputation: 16532

We used tipsy once for something very similar. http://plugins.jquery.com/project/tipsy

We actually took it a step further and "created" an attribute like this

<span class="tipsyItem" tipsy="This is my tooltip text!">This is my regular text!</span>

The reason was that tipsy would still show the regular tooltip on occasion. We used some of the advanced settings like this.

$('.tipsyItem').tipsy({title: 'tipsy'});

Plus you can theme it. Also were even able to get it to support html embedded in the tooltips for links and such.

$('.tipsyItem').tipsy({html: true });

Twitter used to use tipsy. I'm not sure if they still do.

Upvotes: 1

Related Questions