Monday, July 8, 2013

Get the value of checked checkbox?

var boxes = document.getElementsByName('<%= rdlIsMobile.ClientID %>');
            var val = '';
            var len = boxes.length;
            for (var i = 0; i < len; i++) {
                if (boxes[i].checked) {
                    flag = true;
                    val = boxes[i].value;
                    break;
                }
                //alert(i + (boxes[i].checked ? ' checked ' : ' unchecked ') + boxes[i].value);
            }

No comments:

Post a Comment