使用jQuery在列表框中选择值显示工具提示 [英] Show the tooltip in the list box selected value using jQuery
本文介绍了使用jQuery在列表框中选择值显示工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当列表框上的鼠标值时,如何显示标题或工具提示,如下图所示?
How do I show the title or tooltip when the mouse on the list box value, as in the following picture?
。
推荐答案
参见示例: :
<!-- Include custom code to handle the tooltip -->
<script type="text/javascript">
//After loading the page insert the title attribute.
$(function(){
$("select option").attr( "title", "" );
$("select option").each(function(i){
this.title = this.text;
})
});
//Attach a tooltip to select elements
$("select").tooltip({
left: 25
});
</script>
<!-- When moving the mouse over the below options -->
<select>
<option>very long option text 1</option>
<option>very long option text 2</option>
<option>very long option text 3</option>
<option>very long option text 4</option>
<option>very long option text 5</option>
<option>very long option text 6</option>
</select>
这篇关于使用jQuery在列表框中选择值显示工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文