4

I am looking to display a info box when user hover on the select option. for ex:

    <select id = "sel">
       <option value="sick leave">Sick leave</option>
       <option value="urgent leave">urgent leave</option>
       <option value="maternity leave">Maternity leave</option>
       <option value="relocation leave">Relocation leave</option>
     </select>

when the user mouse over the options a message box should display showing the number of leaves he is left with of that particular type and as he moves down the info should change according to the type of leave the cursor is pointing

amrender singh
  • 7,949
  • 3
  • 22
  • 28

2 Answers2

0

You would want to do this using css psuedo elements.

Someone asked a very similar question and received a detailed response here:

How to create a box when mouse over text in pure CSS?

Community
  • 1
  • 1
Ryan Novas
  • 130
  • 7
0

Use title attribute on each option in the select element, it works for me so it should for you.

<select id="sel">
   <option title="This is a Sick leave" value="sick leave">Sick leave</option>
   <option title="This is a urgent leave" value="urgent leave">urgent leave</option>
   <option title="This is a Maternity leave" value="maternity leave">Maternity leave</option>
   <option title="This is a Relocation leave" value="relocation leave">Relocation leave</option>
</select>