0

I have a drop down menu with options. Is there a faster way to display a tool tip based on the value of the <option> tag other than having to manually set title="" for each <option> tag?

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by tinymark
0

You can do it with script, but you still have to write all the tooltips. Do you want all the same or different tooltips?

0

You can do it with script, but you still have to write all the tooltips. Do you want all the same or different tooltips?

The tool tip will be based on the value of the option tag's value (as stated). If the value of an option = "Walnut", then I want the tool tip to read "Walnut" when that option is hovered.

0

I get it.

<body>
<select>
  <option class = 'volvo' value="volvo">Volvo</option>
  <option class = 'saab' value="saab">Saab</option>
  <option class = 'mercedes' value="mercedes">Mercedes</option>
  <option class = 'audi' value="audi">Audi</option>
</select>
<script type='text/javascript'>
$(document).ready(function(){
	$("select option").each(function(){
		var title = $(this).attr('value');
		$(this).attr("title", title);
	});
});
</script>
</body>

Now you got it.

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.