回答編集履歴
2
調整
test
CHANGED
@@ -83,3 +83,33 @@
|
|
83
83
|
</div>
|
84
84
|
|
85
85
|
```
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
# IE対応
|
90
|
+
|
91
|
+
```javascript
|
92
|
+
|
93
|
+
$(function(){
|
94
|
+
|
95
|
+
$('.child').each(function(){
|
96
|
+
|
97
|
+
$(this).clone().prop('disabled',true).removeClass('child').addClass('child2').hide().appendTo($(this).parent());
|
98
|
+
|
99
|
+
$(this).find('option:not(:first)').remove();
|
100
|
+
|
101
|
+
});
|
102
|
+
|
103
|
+
$('.parent').on('change',function(){
|
104
|
+
|
105
|
+
$(this).closest('.selectDiv').next('.selectDiv')
|
106
|
+
|
107
|
+
.find('.child option:not(:first)').remove().end()
|
108
|
+
|
109
|
+
.find('.child2 option[data-val="'+$(this).val()+'"]').clone().appendTo($(this).closest('.selectDiv').next('.selectDiv').find('.child'));
|
110
|
+
|
111
|
+
}).trigger('change');
|
112
|
+
|
113
|
+
});
|
114
|
+
|
115
|
+
```
|
1
調整
test
CHANGED
@@ -4,7 +4,11 @@
|
|
4
4
|
|
5
5
|
$('.selectDiv .parent').on('change',function(){
|
6
6
|
|
7
|
-
$(this).closest('.selectDiv').next('.selectDiv').find('.child option:not(:first)').hide().filter('[data-val="'+$(this).val()+'"]').show();
|
7
|
+
$(this).closest('.selectDiv').next('.selectDiv').find('.child option:not(:first)').hide().filter('[data-val="'+$(this).val()+'"]').show().end().end().find('.child option:first').prop('selected',true);
|
8
|
+
|
9
|
+
// 調整
|
10
|
+
|
11
|
+
// $(this).closest('.selectDiv').next('.selectDiv').find('.child option:not(:first)').hide().filter('[data-val="'+$(this).val()+'"]').show();
|
8
12
|
|
9
13
|
}).trigger('change');
|
10
14
|
|