回答編集履歴

1

コード修正

2020/11/24 15:29

投稿

cerfweb
cerfweb

スコア1905

test CHANGED
@@ -76,19 +76,33 @@
76
76
 
77
77
  let op_cnt = 0;
78
78
 
79
- $(child).children().each(function(){
79
+ $(child).find('option').each(function(){
80
80
 
81
81
  let op = $(this);
82
82
 
83
83
  if ( ! op.data('val') || op.data('val') == val) {
84
84
 
85
- op.show();
85
+ if (op.closest('span.hide').length) {
86
86
 
87
+ op.unwrap();
88
+
89
+ }
90
+
91
+
92
+
93
+ if (op.data('val') == val) {
94
+
87
- op_cnt ++;
95
+ op_cnt ++;
96
+
97
+ }
88
98
 
89
99
  } else {
90
100
 
91
- op.hide();
101
+ if ( ! op.closest('span.hide').length) {
102
+
103
+ op.wrap('<span class="hide">');
104
+
105
+ }
92
106
 
93
107
  }
94
108
 
@@ -114,6 +128,8 @@
114
128
 
115
129
  });
116
130
 
131
+ ```
117
132
 
133
+ 追記:
118
134
 
119
- ```
135
+ iOSで```option```の```display:none;```が効かないため、```span```で囲むという方法に変えました。