回答編集履歴
1
ミスがあったため修正。
test
CHANGED
@@ -35,3 +35,69 @@
|
|
35
35
|
} );
|
36
36
|
|
37
37
|
```**動くサンプル:**[https://jsfiddle.net/sh8pnxgj/](https://jsfiddle.net/sh8pnxgj/)
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
---
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
**追記:**
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
要件を満たしていなかったので修正。
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
```HTML
|
58
|
+
|
59
|
+
<select id="aaa" name="example1" size="3">
|
60
|
+
|
61
|
+
<option value="sample1" selected>sample1</option>
|
62
|
+
|
63
|
+
<option value="sample2">sample2</option>
|
64
|
+
|
65
|
+
<option value="sample3">sample3</option>
|
66
|
+
|
67
|
+
</select>
|
68
|
+
|
69
|
+
<select id="bbb" name="example2" size="3">
|
70
|
+
|
71
|
+
<option value="sample4">sample4</option>
|
72
|
+
|
73
|
+
<option value="sample5" selected>sample5</option>
|
74
|
+
|
75
|
+
<option value="sample6">sample6</option>
|
76
|
+
|
77
|
+
</select>
|
78
|
+
|
79
|
+
<select id="ccc" name="example2" size="3">
|
80
|
+
|
81
|
+
<option value="sample4">sample4</option>
|
82
|
+
|
83
|
+
<option value="sample5" selected>sample5</option>
|
84
|
+
|
85
|
+
<option value="sample6">sample6</option>
|
86
|
+
|
87
|
+
</select>
|
88
|
+
|
89
|
+
```
|
90
|
+
|
91
|
+
```JavaScript
|
92
|
+
|
93
|
+
$( function() {
|
94
|
+
|
95
|
+
$( 'select' ).on( 'change', function(){
|
96
|
+
|
97
|
+
$( 'select:not(#' + $( this ).attr( 'id' ) + ') option:selected' ).prop( 'selected', false );
|
98
|
+
|
99
|
+
} ).eq( 0 ).trigger( 'change' );
|
100
|
+
|
101
|
+
} );
|
102
|
+
|
103
|
+
```**動くサンプル:**[https://jsfiddle.net/sh8pnxgj/1/](https://jsfiddle.net/sh8pnxgj/1/)
|