Hi all,
I have a form with select box, collecting the select box items from the database table column…
Now i want to add a tool tip in a customized manner, by getting the data from the database table…
When a user scrolls on the select box items, the tool tip will show by getting the data from the database for each item respectively…
I tried by using the title attribute of the <option> tag, but some browsers are not showing that…
How to implement this with specific functionality to show the tool tip, in all the browsers?
I would create a JavaScript array to hold the text to be shown in the tootip and pull it with the value of selected option upon selecting an option. Hope you understand what I mean.
Thanks for your reply,
I understand.
But how to assign the array of text value getting from database to the JavaScript array?
And how to show the related tooltip for that, when i mouse over.?
can you give me some example to do it.?
Ahh… I understood in different way of showing the tooltip upon selection not in the mouse over on the options. title attributes works in FF and IE 7/8/9 but not in Chrome. Not sure with other browsers. You may try the ‘mouseenter’ & ‘mouseleave’ events introduced by Microsoft as well.
I would use jquery and build up the form dynamically.
If I read correctly what you are trying to do you could build up the elements from a database query putting the tooltip text in as a title on each form element and get something like this:
<input type=“checkbox” id=“check” title=“Required to proceed” />
You could then write some jquery to check for a title on mouseenter and display that title as a tooltip: