How to get the checkboxlist text using Javacsript in


So many time we will get scenario to read the checkbox list using JavaScript, we can do this task like this

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb" Inherits="Test_Default3" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
<script type="text/javascript">

function getCheckBoxListItemsChecked(elementId) {
var elementRef = document.getElementById(elementId);
var checkBoxArray = elementRef.getElementsByTagName('input');
var checkedValues = '';

for (var i = 0; i < checkBoxArray.length; i++) {
var checkBoxRef = checkBoxArray[i];

if (checkBoxRef.checked == true) {
// for getting the value
var value1 = checkBoxArray[i].value;
// For getting the text value

var labelArray = checkBoxRef.parentNode.getElementsByTagName('label');
if (labelArray.length > 0) {
if (checkedValues.length > 0)
checkedValues += ', ';
checkedValues += labelArray[0].innerHTML;


return checkedValues;

function readCheckBoxList() {
var checkedItems = getCheckBoxListItemsChecked('<%= CheckBoxList2.ClientID %>');
<form id="form1" runat="server">

<asp:CheckBoxList ID="CheckBoxList2"  runat="server">
<input type="button" onclick="readCheckBoxList();" value="Read CheckBoxList" />



4 thoughts on “How to get the checkboxlist text using Javacsript in

  1. Free Instagram Followers February 27, 2014 / 3:39 am

    Excellent post. Keep posting such kind of information on your site.
    Im really impressed by it.
    Hello there, You’ve performed a fantastic job. I’ll certainly digg it and for my part recommend to my friends.
    I’m sure they’ll be benefited from this web site.

  2. buy 1000 instagram followers cheap June 14, 2014 / 8:23 pm

    Hi there! Do you use Twitter? I’d like to follow you if that would be ok.
    I’m definitely enjoying your blog and look forward to new posts.

  3. where can i buy phen375 June 17, 2014 / 11:12 am

    Hi there! Do you know if they make any plugins to assist with Search Engine
    Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m
    not seeing very good success. If you know of any please share.
    Many thanks!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.