У меня есть checkBoxList
<asp:CheckBoxList ID="cheBoxTypeOfInc" runat="server" onchange="checkBoxchanged()" CssClass="form-checkbox" Height="39px" Width="493px" RepeatDirection="Horizontal" RepeatColumns="1">
<asp:ListItem Value="CommMotVehiAcci">Commercial Motor Vehicle Accident</asp:ListItem>
<asp:ListItem Value="EmpInjry">Employee Injury </asp:ListItem>
</asp:CheckBoxList>
и я добавляю к нему еще пункт как addElement("InciRepo", "Incident Reporting");
и определение addElement является следующим:
function addElement(a, b) {
var tableRef = document.getElementById('<%= cheBoxTypeOfInc.ClientID %>');
var tableRow = tableRef.insertRow();
var tableCell = tableRow.insertCell();
var checkBoxRef = document.createElement('input');
var labelRef = document.createElement('label');
checkBoxRef.type = 'checkbox';
checkBoxRef.id = a;
labelRef.innerHTML = b;
checkBoxRef.value = a;
tableCell.appendChild(checkBoxRef);
tableCell.appendChild(labelRef);
}
Я хочу прочитать выбранное значение, используя Javascript как
function checkBoxchanged()
{
debugger;
var chebox = document.getElementById('<%= cheBoxTypeOfInc.ClientID %>');
var checkboxesChecked = [];
// loop over them all
for (var i = 0; i < checkboxes.length; i++) {
// And stick the checked ones onto an array...
if (checkboxes[i].checked) {
checkboxesChecked.push(checkboxes[i]);
}
}
но это не дает мне список. На самом деле, когда я ищу выбранный пункт, его не показывается также проверено.
я что-то упустил? Есть ли другой способ активировать это? Пожалуйста, совет !!