thchaver
thchaver

Reputation:

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?

Upvotes: 2

Views: 1518

Answers (3)

FunMatters
FunMatters

Reputation: 601

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);
}

})

Upvotes: 0

Don Fitz
Don Fitz

Reputation: 1174

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

Upvotes: 0

Lazarus
Lazarus

Reputation: 43074

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.

Upvotes: 1

Related Questions