0

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.

  • Are you sure the ID is correct? because it works for me http://jsfiddle.net/8S2we/ – Mr. Alien Mar 31 '14 at 05:44
  • @Mr.Alien: Yes. I am using the right id of the control. except i am using control. Not the control. –  Mar 31 '14 at 05:47

1 Answers1

0

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);
Community
  • 1
  • 1
Jalpesh Vadgama
  • 13,653
  • 19
  • 72
  • 94