Sujatha Aithal

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromSujatha Aithal
ToMe
SubjectDisplay tooltip for option tag [using javascript]
Date20 July 2005 14:47
Hello Mr. Mark 

Your Perfect Popup Script is really superb. It helped me a lot. Your site is
very informative. Hats off to your service.

Let me come to the point of this mail. I am trying to find a solution for a
problem, which at present is very much necessary to my contest/requirement
(unavoidable too). Requesting you to help me out with a best solution in
this issue in some way or the other.

Here it follows.

I just want to know how to display a tooltip in an option tag. HTML's
"Title" attribute doesn't work in this form element. My intention is to
restrict the size of the select box and to show the option value in a
tooltip, when the user moves on the particular option. This will be useful
if the message exceeds the size and the user can still read the full message
using the tooltip.

Is there any way to achieve this?

Thanks in advance

Suja
FromMe
ToSujatha Aithal
SubjectRe: Display tooltip for option tag [using javascript]
Date25 July 2005 15:19
Sujatha,

> I just want to know how to display a tooltip in an option tag. HTML's
> "Title" attribute doesn't work in this form element.

The option element can accept the title, but no browsers are able to use it.

> Is there any way to achieve this?

None that I can think of. The problem is that different browsers and
operating systems use different widgets to display it. In particular, the
widgets used on Mac are impossible, as they often incorrectly scroll the
content initially out of view.

Anyway what would be nice would be to be able to detect the mouse events on
the option, and then calculate their position, but this will fail because
not only do not all users have a mouse, but mouse events do not work
properly with option elements, and neither does calculating the position,
since that will depend on select element scrolling and option offset being
taken into account. That is not possible because of the way that widgets
work. So sorry, I do not have an answer.

Anyway, there might be something you can do, but it is ugly, and I do not
know if it would work:
write a script that contstantly marquees the contents of the option
elements, showing only a substring of their contents. Maybe only run the
script while the box is focused. I do not like this, but it might be the
only possibility if the contents are far too big.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromSujatha Aithal
ToMe
SubjectDisplay tooltip for option tag [using javascript]
Date27 July 2005 07:02
Tarquin - Thanking you a lot for the suggestion.

I think that's the only possible way to achieve  - I suppose. I will try
your idea. Initially, we had a plan to bring in a "Div/Layer" at the top of
each Selection box and display the content once the user selects their
appropriate option.

Suja
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.