Two Laptop Bag
The moose likes HTML, CSS and JavaScript and the fly likes Show hovered drop down item as tooltip Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Show hovered drop down item as tooltip" Watch "Show hovered drop down item as tooltip" New topic
Author

Show hovered drop down item as tooltip

Ramaprasad Kolla
Greenhorn

Joined: Oct 22, 2008
Posts: 23
Hi All,

Good morning!

I have a scenario where I show a drop-down-with-few-items in a JSP page, to the user.
The length of few options in the drop down is greater than that of the drop down's, hence our requirement is to show the
hovered (not selected) option as tooltip for user's convenience.
I could not find a suitable event when hovered a drop down.

Can you please suggest me some a solution?

Thanks in Advance,
Ramaprasad K


Thanks,
Ramaprasad K
In Love with Java -@
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56224
    
  13

Not a JSP question. Moved to the HTML forum.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56224
    
  13

There is no means to do this with a conventional select element. You'll either need to find one built with DOM-scripting or write one yourself.
Shrinath M Aithal
Ranch Hand

Joined: May 20, 2009
Posts: 82
Ramaprasad Kolla wrote:
I could not find a suitable event when hovered a drop down.


read this first..
Sun's forum

now that you know you cant handle mouse events with JSP, try it with javascript.. I have seen a place where they show an example of how to do it.. :
onmouseover tutorial

have you seen how windows opens the "All programs" menu from start button ? when you hover your mouse over the "all programs" menu, it opens the next menu.. you too do something like that.. if you have a list of 30 items, show 10, and let the 10th item be a special symbol which indicates down arrow or right arrow.. when user hovers over it, use the java script to check the mouse hover, and generate the second list to show full items..

does that sound good ?

Regards
Shri..

SCJP 5.0
Ramaprasad Kolla
Greenhorn

Joined: Oct 22, 2008
Posts: 23
Shri.,

I am also trying the same using scripting (onmouseover event). But I couldnot find how to get the hovered text.
I cannot use the windows concept here as I need to show the populated drop down list items as tool tips.
Shrinath M Aithal
Ranch Hand

Joined: May 20, 2009
Posts: 82
Ramaprasad Kolla wrote:Shri.,

I am also trying the same using scripting (onmouseover event). But I couldnot find how to get the hovered text.
I cannot use the windows concept here as I need to show the populated drop down list items as tool tips.


why do you persist on tooltips ? your program will be notified when the mouse is on the particular spot.. when it happens, call the function to show another list ..
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6
SOme browsers suppoert title in the options list, most do not. They also do not support mouseover events. If you want to do this, you basically have to code your own select element out of divs, and lists, and links.

Eric
Ramaprasad Kolla
Greenhorn

Joined: Oct 22, 2008
Posts: 23

why do you persist on tooltips ?

In our screen the drop down is of some length and the text populated in it is larger than its size. In that case we need to show the hovered drop down item in a tool tip so that user can select one. This is why I strictly persist on tooltips.

your program will be notified when the mouse is on the particular spot

Though it notifies I cannot find the current hovered drop down item as I donot have appropriate properties for getting the hovered item.

As told by Eric, we have browser issues and I think I have to go for a custom SELECT. Will work on that.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Show hovered drop down item as tooltip
 
Similar Threads
How to display tootip for the seleted option in list
Display tooltip when mouse is hovered on a certain word in textarea
ToolTip help
need list of button
Combo Box search as user types