0

Hello,

In HTML select tag I use onmouseover and onmouseout events to show the field value as a hint in case if the content doesn't fit in combo box.
The problem is when the combo box is expanded and I move the mouse through the content it shows the wrong hints. Everything is OK if the value is selected.
I checked this in Google Chrome and noticed that hints doesn't appear when the combo box is expanded. Seems it is a firefox problem.
Please advice.
Below is my code:

<html style="height: 100%; overflow: hidden;" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script type="text/javascript">
        function showTooltip(component, combo) {
            if (combo) {
                component.title = component.options[component.selectedIndex].text;
            } else {
                component.title = component.value;
            }
        }

        function hideTooltip(component) {
            component.title = '';
        }
    </script>

    <body>
    <form>
        <select onmouseover="showTooltip(this, true);"
                onmouseout="hideTooltip(this);">
            <option>California -- CA</option>
            <option>Colorado -- CO</option>
            <option>Connecticut -- CN</option>

        </select>
    </form>
    </body>
</head>
</html>
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Vemari
0

If you provide a title attribute for your option tag, the standard browser tooltip should work just fine without JS.

0

I need to show always the current value as a hint, i.e. if the value of the combo was 'A' and 'B' is selected, the hint should be 'B'.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.