|
106 | 106 | }) |
107 | 107 | .val(id) |
108 | 108 | .click(function() { |
109 | | - var $radio = $(this).closest('.select').find('input[type=radio]'); |
110 | | - |
111 | | - if ($(this).attr('type') == 'checkbox') { |
112 | | - if ($(this).closest('.select-container').hasClass('single-select') || |
113 | | - !$(this).closest('.select').siblings().filter(':visible').size()) { |
114 | | - $(this).closest('.select').siblings().find('input[type=checkbox]') |
115 | | - .attr('checked', false); |
| 109 | + var $select = $(this).closest('.select'); |
| 110 | + var $radio = $select.find('input[type=radio]'); |
| 111 | + var $newNetwork = $(this).closest('.content').find('.select.new-network'); |
| 112 | + var $otherSelects = $select.siblings().filter(':visible'); |
| 113 | + var isCheckbox = $(this).attr('type') == 'checkbox'; |
| 114 | + var isSingleSelect = $(this).closest('.select-container').hasClass('single-select'); |
| 115 | + |
| 116 | + if (isCheckbox) { |
| 117 | + if ((isSingleSelect || !$otherSelects.size()) && |
| 118 | + $newNetwork.find('input[type=checkbox]').is(':unchecked')) { |
| 119 | + $otherSelects.find('input[type=checkbox]').attr('checked', false); |
| 120 | + |
| 121 | + // Set as default |
116 | 122 | $(this).closest('.select').find('input[type=radio]').click(); |
117 | 123 | } |
118 | 124 | } |
|
121 | 127 | if (!$radio.closest('.select').index()) { |
122 | 128 | return false; |
123 | 129 | } else { |
124 | | - $radio |
125 | | - .closest('.select') |
126 | | - .siblings().filter(':first') |
| 130 | + $otherSelects.filter(':first') |
127 | 131 | .find('input[type=radio]').click(); |
128 | 132 | } |
129 | 133 | } |
|
477 | 481 |
|
478 | 482 | // Select another default if hiding field |
479 | 483 | if ($newNetwork.hasClass('unselected')) { |
480 | | - $step.find('input[type=radio]:first').click(); |
| 484 | + $step.find('input[type=radio]:visible:first').click(); |
481 | 485 | } else { |
482 | 486 | $newNetwork.find('input[type=radio]').click(); |
483 | 487 | } |
|
0 commit comments