0
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="WebUserControl.ascx.vb" Inherits="WebUserControl" %>
<script src="scripts/jquery-1.5.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $('#chkAll').click(
             function() {
                 $("INPUT[type='checkbox']").attr('checked', $('#chkAll').is(':checked'));
             });
         });    

     </script>


        <div>
        <asp:CheckBox ID="chkAll" runat="server" />
        <asp:CheckBox ID="CheckBox2" runat="server" />
    </div>
4

1 回答 1

1

可能控制 ID 已更改。尝试

$('#<%=chkAll.ClientID%>')
于 2011-03-09T06:03:12.797 回答