回答編集履歴

1

追記

2020/10/27 01:11

投稿

Jon_do
Jon_do

スコア1373

test CHANGED
@@ -79,3 +79,155 @@
79
79
  </html>
80
80
 
81
81
  ```
82
+
83
+
84
+
85
+ 追記
86
+
87
+
88
+
89
+ ```html
90
+
91
+ <html>
92
+
93
+
94
+
95
+ <form id="form" action="https://~~~~" class="form-inline" method="post">
96
+
97
+
98
+
99
+ <input type="hidden" name="is_multiple_item" id="is_multiple_item" value="true" />
100
+
101
+ <input type="hidden" name="items[0]id" id="id" value="60" />
102
+
103
+ <input type="hidden" name="items[0]cart_item_type" value="single_product" />
104
+
105
+
106
+
107
+ <div class="form-group">
108
+
109
+ <select name="items[0]option_values[0][id]" id="option_values_0_id">
110
+
111
+ <option value="415">テスト1</option>
112
+
113
+ <option value="416">テスト2</option>
114
+
115
+ <option value="417">テスト3</option>
116
+
117
+ </select>
118
+
119
+ </div>
120
+
121
+
122
+
123
+ <div>個数
124
+
125
+ <select name="items[0]quantity" id="quantity1" class="form-control custom_quantity">
126
+
127
+ <option value="1">1</option>
128
+
129
+ <option value="2">2</option>
130
+
131
+ <option value="3">3</option>
132
+
133
+ <option value="4">4</option>
134
+
135
+ <option value="5">5</option>
136
+
137
+ </select>
138
+
139
+ </div>
140
+
141
+
142
+
143
+ <input type="hidden" name="items[1]cart_item_type" value="regular_course" />
144
+
145
+ <input type="hidden" name="items[1]id" id="id1" value="16" />
146
+
147
+ <input type="hidden" name="items[1]products[][variant_id]" value="" />
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+ <div class="form-group">
156
+
157
+
158
+
159
+ <select name="items[1]option_values[1][id]" id="test">
160
+
161
+ <option value="679">A</option>
162
+
163
+ <option value="481">B</option>
164
+
165
+ <option value="44">C</option>
166
+
167
+ <option value="43">D</option>
168
+
169
+ <option value="42">E</option>
170
+
171
+ </select>
172
+
173
+ </div>
174
+
175
+
176
+
177
+
178
+
179
+ <div>個数
180
+
181
+ <select name="items[1]quantity" id="quantity" class="form-control">
182
+
183
+ <option value="1">1</option>
184
+
185
+ <option value="2">2</option>
186
+
187
+ <option value="3">3</option>
188
+
189
+ <option value="4">4</option>
190
+
191
+ <option value="5">5</option>
192
+
193
+ </select>
194
+
195
+ </div>
196
+
197
+
198
+
199
+
200
+
201
+ <button name="button" type="submit" class="btn btn-primary">購入する</button>
202
+
203
+ <script>
204
+
205
+ const input = document.getElementsByTagName("input")[5];
206
+
207
+ const select = document.getElementById("test");
208
+
209
+
210
+
211
+ input.value = select.value;
212
+
213
+ console.log(input.value);
214
+
215
+
216
+
217
+ select.addEventListener("change", () => {
218
+
219
+ input.value = select.value;
220
+
221
+ console.log(input.value);
222
+
223
+ });
224
+
225
+ </script>
226
+
227
+ </form>
228
+
229
+
230
+
231
+ </html>
232
+
233
+ ```