Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#checkbox1").attr("checked", $("#checkbox2").attr("checked"))
- <asp:CheckBox runat="server" ID="CheckBox1" onclick="checkBoxChanged1(this)" />
- <asp:CheckBox runat="server" ID="CheckBox2" onclick="checkBoxChanged2(this)"/>
- <script type="text/javascript">
- var checkBox1 = document.getElementById("<%=CheckBox1.ClientID %>");
- var checkBox2 = document.getElementById("<%=CheckBox2.ClientID %>");
- function checkBoxChanged1(e)
- {
- checkBox2.checked = e.checked;
- }
- function checkBoxChanged2(e)
- {
- checkBox1.checked = e.checked;
- }
- </script>
- <script type="text/javascript">
- $(function(){
- $("#<%=CheckBox1.ClientID %>").click(function(){
- $("#<%=CheckBox2.ClientID %>").checked = this.checked;
- });
- $("#<%=CheckBox2.ClientID %>").click(function(){
- $("#<%=CheckBox1.ClientID %>").checked = this.checked;
- });
- });
- </script>
Add Comment
Please, Sign In to add comment