Either using plain HTML or jQuery assisted JavaScript, how do you display tooltips on individual <option>
elements to aid the decision process (there is not enough room for a different kind of control and some help will be needed).
Can this be done though a plug-in or similar?
I have tried a few tooltip plugins for jQuery with no success (including the one called Tooltip).
This solution should:
- work in IE, WebKit as well as Gecko;
- utilizing standard
<select>
wrapped<option>
elements.
So if the solution wants to use other tags it should convert those elements into what it needs dynamically (and not expect the initial mark-up to be any different).
The code for this can be found here, it is under the SafeSurf section, where I want to display some help on rollover of the options as to the meaning of the choices. At present it can only be displayed "after the fact" and some upfront help for the user would be beneficial.
Appreciate that this is not easy and that something will probably need to be created - so the bounty will be awarded to the most complete solution or the specific hook that lands me closest to a solution I can create.
At least on firefox, you can set a "title" attribute on the option tag:
<option value="" title="Tooltip">Some option</option>
If increasing the number of visible options is available, the following might work for you:
Why use a dropdown at all? The only way the user will see your explanatory text is by blindly hovering over one of the options.
I think it would be preferable to use a radio button group, and next to each item, put a tooltip icon indicating additional information, as well as displaying it after selection (like you currently have it).
I realize this doesn't exactly solve your problem, but I don't see the point in struggling with an html element that's notorious for its inflexibility when you could just use one that's better suited in the first place.
I don't think this would be possible to do across all browsers.
W3Schools reports that the option events exist in all browsers, but after setting up this test demo. I can only get it to work for Firefox (not Chrome or IE), I haven't tested it on other browsers.
Firefox also allows mouseenter and mouseleave but this is not reported on the w3schools page.
Update: Honestly, from looking at the example code you provided, I wouldn't even use a select box. I think it would look nicer with a slider. I've updated your demo. I had to make a few minor changes to your ratings object (adding a level number) and the safesurf tab. But I left pretty much everything else intact.
I just tried doing this on Chrome:
However, the hover enter never fires... So you wouldn't be able to do this at all using the standard select. You could achieve this though through some non standard ways:
It seems in the 2 years since this was asked, the other browsers have caught up (at least on Windows... not sure about others). You can set a "title" attribute on the option tag:
<option value="" title="Tooltip">Some option</option>
This worked in Chrome 20, IE 9 (and its 8 & 7 modes), Firefox 3.6, RockMelt 16 (Chromium based) all on Windows 7