【发布时间】:2016-08-17 17:28:17
【问题描述】:
我在触发服务器端按钮时遇到问题,我想做类似于this 的操作,但使用服务器端按钮和复选框。它目前不起作用,我不知道为什么?
$(function all() {
$("<%= btnSelect.ClientID %>").click(function () {
if (document.getElementById("<%= btnSelect.ClientID %>") == 'Select All') {
$('.button input').prop('checked', true);
document.getElementById("<%= btnChkboxSelect.ClientID %>").value = "Unselect All";
} else {
$('.button input').prop('checked', false);
document.getElementById("<%= btnChkboxSelect.ClientID %>").value = "Select All";
}
});
});
<body>
<div id="main">
<div id="first">
<asp:Button ID="btnSelect" runat="server" UseSubmitBehavior="false" Text="Select All" OnClientClick="all();" />
<div class="button">
<div>
<asp:CheckBox ID="checbox1" runat="server" />
</div>
<div>
<asp:CheckBox ID="checbox2" runat="server" />
</div>
<div>
<asp:CheckBox ID="checbox3" runat="server" />
</div>
</div>
</body>
【问题讨论】:
标签: javascript jquery html button server-side