Question

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.

Was it helpful?

Solution

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top