javascript and checkboxlist values for items that are checked

C

cindy

I have an asp:checkboxlist
I have javascript that onpostback will create a string from checkboxlist
item values where item is checked.
I need help, I can get the index of item but I can't get the value. Alert
fires the correct index for the item that is checked.
???????? What is the syntax for the item value??

var tableBody = document.getElementById(checkboxlistID).childNodes[0];
for (var i=0;i<tableBody.childNodes.length; i++)
{
var currentTd = tableBody.childNodes.childNodes[0];
var listControl = currentTd.childNodes[0];
if ( listControl.checked == true )
alert('#' + i + ': is checked');
}

I am using version 1.1 .NET
 
P

Phillip Williams

var listItemLabel = currentTd.childNodes[1];
if (listItemLabel != null) alert(listItemLabel.innerText);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top