开发者

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

开发者 https://www.devze.com 2023-02-03 07:02 出处:网络
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.

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 fir开发者_如何学编程st day using MVC


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号