开发者

Validation of Checkbox in Listview Control by Jquery/Javascript?

I am trying to validate the checkbox which is one of the items in ListView control.

I have the button to check so I define the ClientClick function on the button and wrote JavaScript code.

But It didn't work. Display the lstViewtest object null.

    function btnclick() {
        var listview = document.getElementById('<%=
 lstviewtest.FindControl("tableItem").ClientID %>');
                
        for (var i = 0; i < listview.rows.length; i++) {
            va开发者_StackOverflowr inputs = listview.rows[i].getElementsByTagName('input');
            for (var j = 0; j < inputs.length; j++) {
                if (inputs[j].type === "checkbox" || inputs[j].type === "checkboxsend")
                    if (inputs[j].checked)
                        return true;
            }
            alert("Please select at least one");
            return false;
        } 
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜