Guest User

Untitled

a guest
Jun 21st, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. $("#checkbox1").attr("checked", $("#checkbox2").attr("checked"))
  2.  
  3. <asp:CheckBox runat="server" ID="CheckBox1" onclick="checkBoxChanged1(this)" />
  4. <asp:CheckBox runat="server" ID="CheckBox2" onclick="checkBoxChanged2(this)"/>
  5.  
  6. <script type="text/javascript">
  7. var checkBox1 = document.getElementById("<%=CheckBox1.ClientID %>");
  8. var checkBox2 = document.getElementById("<%=CheckBox2.ClientID %>");
  9. function checkBoxChanged1(e)
  10. {
  11. checkBox2.checked = e.checked;
  12. }
  13. function checkBoxChanged2(e)
  14. {
  15. checkBox1.checked = e.checked;
  16. }
  17. </script>
  18.  
  19. <script type="text/javascript">
  20. $(function(){
  21. $("#<%=CheckBox1.ClientID %>").click(function(){
  22. $("#<%=CheckBox2.ClientID %>").checked = this.checked;
  23. });
  24. $("#<%=CheckBox2.ClientID %>").click(function(){
  25. $("#<%=CheckBox1.ClientID %>").checked = this.checked;
  26. });
  27. });
  28. </script>
Add Comment
Please, Sign In to add comment