开发者

DropDownList tooltip in Chrome and Safari

To add a tooltip to my DropDownList items I have

 开发者_运维知识库     DropDownList1.Items[i].Attributes.Add("title", tooltip);

Problem is this doesn't work in Chrome and Safari. Any other way to add a tooltip, or any way to fix this in Chrome and Safari?


Add or bind tooltip for dropdownlist items in asp.net by C# http://asp-net-by-parijat.blogspot.in/2014/08/add-or-bind-tooltip-for-dropdownlist.html


There are plenty of tooltip components, also jQuery has a number of plug-ins that can offer this kind of functionality. I know what you are suffering as the tooltips appear as expected in IE but in Chrome/Safari they tend to be blank boxes. It'll be interesting to see if anyone else has a fix for that specifically.


You could just use the ToolTip property of the dropdown list: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist.tooltip.aspx


Using jQuery:

// Assign Tooltip value on click of dropdown list  //    
  $(document).ready(function () {
    try{  
     $('select').click(function (el) {    
         $(this).find("option:[title='']").each(function (el) {       
                                   $(this).attr("title",$(this).text());
         })                
      });
    }
    catch(e)
{
    alert(e);
}

})

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜