質問編集履歴

1

コード(Class→Name)に変更。内容の簡略化

2020/07/13 07:13

投稿

wokapi
wokapi

スコア12

test CHANGED
File without changes
test CHANGED
@@ -24,19 +24,15 @@
24
24
 
25
25
  -----------以下、ラジオボタンA~Bに該当----------
26
26
 
27
- @foreach($SA as $id => $ABC)
27
+ @foreach($XXX as $id => $YYY)
28
28
 
29
- <tr>
29
+ <tr>
30
30
 
31
- <td>
31
+ <label class="radio" name="choice1">
32
32
 
33
- <label class="radio">
34
-
35
- <input type="radio" name="ship_address_id" value="{{$id}}"
33
+ <input type="radio" name="A-NAME" value="{{$id}}"
36
34
 
37
35
  @if($loop->first)
38
-
39
- checked="checked"
40
36
 
41
37
  @endif onclick="formSwitch()">
42
38
 
@@ -44,57 +40,41 @@
44
40
 
45
41
  </label>
46
42
 
47
-
43
+ </tr>
48
44
 
49
- @if(!$loop->first)
50
-
51
- <a href="{{route('A', $address->id)}}" class="btn btn-grey btn-block">編集</a>
52
-
53
- @endif
54
-
55
- </td>
56
-
57
- </tr>
58
-
59
- @endforeach
45
+ @endforeach
60
46
 
61
47
  --------------------以下ラジオボタンC~Dに該当----------------------
62
48
 
63
49
 
64
50
 
65
- <tr id="C">
51
+ <tr id="C">
66
52
 
67
- <th>
53
+ <th>
68
54
 
69
55
  <label class="radio" name="choice2">
70
56
 
71
- <input type="radio" name="payment_method_id" value="2">
57
+ <input type="radio" name="C-NAME" value="2">
72
58
 
73
59
  <span class="radio-icon"></span>
74
60
 
75
61
  </label>
76
62
 
77
- </th>
78
63
 
79
- </tr>
80
64
 
81
- <tr id="D">
65
+ </tr>
82
66
 
83
- <th>
67
+ <tr id="D">
84
68
 
85
69
  <label class="radio" name="choice3">
86
70
 
87
- <input type="radio" name="payment_method_id" value="3" >
71
+ <input type="radio" name="D-NAME" value="3" >
88
72
 
89
73
  <span class="radio-icon"></span>
90
74
 
91
75
  </label>
92
76
 
93
- </th>
94
-
95
- </tr>
77
+ </tr>
96
-
97
- </table>
98
78
 
99
79
 
100
80
 
@@ -102,7 +82,7 @@
102
82
 
103
83
  function formSwitch() {
104
84
 
105
- hoge = document.getElementsByName('ship_address_id')
85
+ hoge = document.getElementsByName('A-NAME')
106
86
 
107
87
  if (hoge[0].checked) {
108
88
 
@@ -110,7 +90,7 @@
110
90
 
111
91
  document.getElementById('D').style.display = "none";
112
92
 
113
- document.getElementByClass('choice2').checked = "checked";
93
+ document.getElementByName('choice2').checked = "checked";
114
94
 
115
95
  } else {
116
96
 
@@ -118,7 +98,7 @@
118
98
 
119
99
  document.getElementById('D').style.display = "";
120
100
 
121
- document.getElementByClass('choice3').checked = "checked";
101
+ document.getElementByName('choice3').checked = "checked";
122
102
 
123
103
  }
124
104