日期:2014-05-16  浏览次数:20397 次

jquery 选中

<script type="text/javascript" src="Scripts/jquery-1.4.1-vsdoc.js"></script>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function(){
            $("#Button1").click(function(){
                 var obj = $("#CheckBoxList1");
             
                    if (obj.attr("checked",true)) {
                        alert("yes");
                    }
                    else {
                        alert("no");
                    }
             //
   
            });
        });
           
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <asp:CheckBoxList ID="CheckBoxList1" runat="server">
            <asp:ListItem Value="0">a</asp:ListItem>
            <asp:ListItem Value="1">b</asp:ListItem>
             <asp:ListItem Value="2">c</asp:ListItem>
            <asp:ListItem Value="3">d</asp:ListItem>
        </asp:CheckBoxList>
    </div>



始终是YES 
没选中也是YEs
求解!!!!!!!!
jquery function html

------解决方案--------------------
if (obj.attr("checked",true)) { 
改成 
if (obj.is(":checked" ) {
------解决方案--------------------
.....楼上正解.