Domanda

How we can achieve to get the value of tooltip of the Radio button in javascript? I tried this method

document.getElementById('<%= rbSelectedIds.ClientID %>').title

but i am getting blank value only. please help me to resolve this issue.

È stato utile?

Soluzione

In ASP.NET radio button and checkbox are renders inside a span control. So when you put tooltip from server side it will apply to span control.

See why its rendering with span from following link. Why does ASP.Net RadioButton and CheckBox render inside a Span?

So you need to find parent element of the control and then you need to get tooltip. Like following.

var sParentElement = document.getElementById("%=rbSelectedIds.ClientID%>").parentElement;
var tooltip = sParentElement.title;
alert(tooltip);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top