javascript datalist question

<cc1:cmybox id="chkcc" runat="server" OnClick="getcheckboxes(this);"  text='<%# Container.DataItem.mytype %>"/>

I need to access value of text from above line in my javascript code getcheckboxes
Who is Participating?
MrunalConnect With a Mentor Commented:
If you want to use only JavaScript then use this solution:
1. Register one javascript variable on binding of this list in code behind.
string sScript = "var hdnchkccClientID = '" + chkcc.ClientID + "';");

then in javascript function use this variable.
e.g. var hdnchkObject = document.getElementById(hdnchkccClientID);
var result = hdnchkObject.value;

2. If you are using jQuery then you can directly put below code in your javascript function:

var result = $('id[$="chkcc"]').val();

hope this helps you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.