[英]ToolTip text as selected value in ASP.Net dropdown
I have ASP.NET dropdown which is too small to display full text the user had selected. 我的ASP.NET下拉列表太小,无法显示用户选择的全文。 So i decided to display selected text in tooltip.
因此,我决定在工具提示中显示选定的文本。
ApplyToDropDown.Attributes.Add("onMouseOver", "ShowApplyToText()");
function ShowApplyToText()
{
var ApplyToDropDown = document.getElementById("ApplyToDropDown");
if(ApplyToDropDown != null)
ApplyToDropDown.ToolTip = ApplyToDropDown.selectedText; // line 5
}
But i am not getting an output.I also tried ApplyToDropDown.title it also didn't work. 但是我没有输出。我也尝试了ApplyToDropDown.title它也没有用。
Please help me on this. 请帮我。
ToolTip
is not a valid attribute of a dropdown element (or its option elements) so unfortunately your script won't work. ToolTip
不是下拉元素(或其选项元素)的有效属性,因此很遗憾,您的脚本无法正常工作。 The attribute you want to use is title
, but unfortunately that will only work on the top dropdown element and not on each option element as you are looking for. 您要使用的属性是
title
,但是不幸的是,该属性仅在顶部下拉元素上起作用,而不在您要查找的每个option元素上起作用。
The only way to get this to work would be with some javascript/css trickery where you would hover a div with the tooltip in it next to the dropdown, but there's nothing unfortunately that's built-in that can do this. 使其工作的唯一方法是使用一些javascript / css技巧,您可以将div旁边的工具提示悬停在div旁边,但是不幸的是,没有内置的功能可以做到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.