回答編集履歴

1

IE

2021/03/21 10:10

投稿

yambejp
yambejp

スコア114883

test CHANGED
@@ -147,3 +147,43 @@
147
147
  </div>
148
148
 
149
149
  ```
150
+
151
+ # IE対応
152
+
153
+ ```javascript
154
+
155
+ ["input","change"].forEach(function(x){
156
+
157
+ document.addEventListener(x,callback);
158
+
159
+ });;
160
+
161
+ function callback(){
162
+
163
+ const q=[].map.call(document.querySelectorAll('#team [type="number"]'),function(x){
164
+
165
+ return parseInt(x.value||0);
166
+
167
+ }).reduce(function(x,y){
168
+
169
+ return x+y;
170
+
171
+ });
172
+
173
+ const p=[].map.call(document.querySelectorAll('.select-checkbox:checked'),function(x){
174
+
175
+ return parseInt(x.value);
176
+
177
+ }).reduce(function(x,y){
178
+
179
+ return x+y;
180
+
181
+ },0);
182
+
183
+ document.querySelector('#sum_quantity').value=q;
184
+
185
+ document.querySelector('#price-chg').textContent=(q*p).toLocaleString();
186
+
187
+ };
188
+
189
+ ```