Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | None | 0 0
  1. //step-1
  2. $('.step1').on('click', function () {
  3. $(this).parent().find('.step2').prop('checked', $(this).prop('checked'))
  4. .end().find('.step3').prop('checked', $(this).prop('checked'));
  5. });
  6. //step-2
  7. $('.step2').on('click', function () {
  8. $(this).parent().find('.step3').prop('checked', $(this).prop('checked'));
  9. if ($(this).parent().parent().find('input:checked').length > 0) {
  10. $(this).parent().parent().parent().find('.step1').prop('checked', true);
  11. } else {
  12. $(this).parent().parent().parent().find('.step1').prop('checked', false);
  13. }
  14. });
  15. //step-3
  16. $('.step3').on('click', function () {
  17. if ($(this).parent().parent().find('input:checked').length > 0) {
  18. $(this).parent().parent().parent().find('.step2').prop('checked', true);
  19. $(this).parent().parent().parent().parent().parent().find('.step1').prop('checked', true);
  20. } else {
  21. $(this).parent().parent().parent().find('.step2').prop('checked', false);
  22. $(this).parent().parent().parent().parent().parent().find('.step1').prop('checked', false);
  23. }
  24. });
  25. <?php $allActions = unserialize(All_ACTION);
  26. foreach ($allActions as $key => $value) {
  27. ?>
  28. <div class="main-ul-div">
  29. <ul>
  30. <li>
  31.  
  32. <input <?php if (in_array($value['url'], $limitArray)) echo "checked"; ?> class="step1" type="checkbox" name="position_keys[]" value="<?php echo $value['url']; ?>"> <span class="main-li-div"><?php echo $value['name']; ?></span> <br />
  33.  
  34. <hr>
  35. <?php if (isset($value['child']) && !empty($value['child'])) { ?>
  36. <ul>
  37. <?php
  38. foreach ($value['child'] as $value2) {
  39. // p($value2);
  40. ?>
  41. <li>
  42. <input <?php if (in_array($value2['url'], $limitArray)) echo "checked"; ?> class="step2" type="checkbox" name="position_keys[]" value="<?php echo $value2['url']; ?>"> <?php echo $value2['name']; ?> <br />
  43. <?php
  44. if (isset($value2['child']) && !empty($value2['child'])) {
  45. ?>
  46. <ul>
  47. <?php
  48. foreach ($value2['child'] as $value3) {
  49. ?>
  50. <li>
  51. <input <?php if (in_array($value3['url'], $limitArray)) echo "checked"; ?> class="step3" type="checkbox" name="position_keys[]" value="<?php echo $value3['url']; ?>"> <?php echo $value3['name']; ?> <br />
  52. </li> <?php
  53. }
  54. ?>
  55. </ul>
  56. <?php
  57. }
  58. ?>
  59. </li>
  60. <?php
  61. }
  62. }
  63. ?></ul>
  64. <?php ?>
  65.  
  66. </li>
  67. </ul>
  68. </div>
  69. <?php }
  70. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement