質問編集履歴

6

不要記述削除

2022/07/12 18:35

投稿

july2022
july2022

スコア10

test CHANGED
File without changes
test CHANGED
@@ -29,7 +29,7 @@
29
29
  Policy.const.button.forEach(function (val, i) {
30
30
  var button;
31
31
  button = document.createElement('button');
32
- button.className = i === 0 ? 'btn btn-warning change' : 'btn btn-info delete';
32
+ button.className = i === 0 ? 'change' : 'delete';
33
33
  button.id = i === 0 ? 'changeID' : 'deleteID';
34
34
 
35
35
  button.onclick = function (e) {

5

記述修正

2022/07/12 10:20

投稿

july2022
july2022

スコア10

test CHANGED
File without changes
test CHANGED
@@ -18,16 +18,37 @@
18
18
 
19
19
  [javascript] —————————————————————
20
20
  ```ここに言語を入力
21
+ body: function (ul, json) {
22
+ $getJSON(json, function (data){
23
+ data.forEach(function(v) {
24
+ var li, spans, buttons;
25
+ li = document.createElement('li');
26
+ spans = makeSpans(v);
27
+ spans.forEach(function (span) { li.appendChild(span); });
28
+ buttons = document.createElement('span');
29
+ Policy.const.button.forEach(function (val, i) {
21
- 中略
30
+ var button;
31
+ button = document.createElement('button');
32
+ button.className = i === 0 ? 'btn btn-warning change' : 'btn btn-info delete';
33
+ button.id = i === 0 ? 'changeID' : 'deleteID';
22
34
 
23
- button.onclick = function (e) {
35
+ button.onclick = function (e) {
24
- i === 0 ? changeEvent(e) : deleteEvent(e) ;
36
+ i === 0 ? ChangeEvent(e) : deleteEvent(e) ;
37
+ };
38
+
39
+ // button.setAttribute('onclick', 'location.href="#modal-chg01"');
40
+ // button.setAttribute('onclick', 'location.href="#modal-del01"');
41
+
42
+ button.textContent = val;
43
+ buttons.appendChild(button);
44
+ });
45
+
46
+ const button =
47
+ li.appendChild(buttons);
48
+ ul.appendChild(li);
49
+ });
50
+ });
25
51
  }
26
-
27
- button.setAttribute('onclick', 'location.href=“#modal-chg01"');
28
- button.setAttribute('onclick', 'location.href=“#modal-del01"');
29
-
30
- — 中略 —
31
52
  ```
32
53
  ————————————————————————————
33
54
 

4

ダブルクォーテーションの修正

2022/07/12 09:45

投稿

july2022
july2022

スコア10

test CHANGED
File without changes
test CHANGED
@@ -8,8 +8,8 @@
8
8
  [HTML] ———————————————————————
9
9
  ```ここに言語を入力
10
10
  <span>
11
- <button class="change id="changeID>変更</button>
11
+ <button class="change" id="changeID">変更</button>
12
- <button class="delete id="deleteID>削除</button>
12
+ <button class="delete" id="deleteID">削除</button>
13
13
  </span>
14
14
 
15
15
  ```
@@ -24,8 +24,8 @@
24
24
  i === 0 ? changeEvent(e) : deleteEvent(e) ;
25
25
  }
26
26
 
27
- button.setAttribute('onclick', 'location.href=“#modal-chg01');
27
+ button.setAttribute('onclick', 'location.href=“#modal-chg01"');
28
- button.setAttribute('onclick', 'location.href=“#modal-del01');
28
+ button.setAttribute('onclick', 'location.href=“#modal-del01"');
29
29
 
30
30
  — 中略 —
31
31
  ```
@@ -40,6 +40,7 @@
40
40
  <button class="delete" id="deleteID" onclick='location.href="#modal-del01"'>削除</button>
41
41
  <span>
42
42
 
43
+
43
44
  ```
44
45
  ————————————————————————————
45
46
 

3

全角混じりのダブルコーテーションを修正

2022/07/12 09:30

投稿

july2022
july2022

スコア10

test CHANGED
File without changes
test CHANGED
@@ -36,8 +36,8 @@
36
36
  [HTML結果] —————————————————————
37
37
  ```ここに言語を入力
38
38
  <span>
39
- <button class="change id="changeID onclick='location.href="#modal-del01"'>変更</button>
39
+ <button class="change" id="changeID" onclick='location.href="#modal-del01"'>変更</button>
40
- <button class="delete id="deleteID onclick='location.href="#modal-del01"'>削除</button>
40
+ <button class="delete" id="deleteID" onclick='location.href="#modal-del01"'>削除</button>
41
41
  <span>
42
42
 
43
43
  ```

2

全角のダブルコーテーションを半角に修正

2022/07/12 09:29

投稿

july2022
july2022

スコア10

test CHANGED
File without changes
test CHANGED
@@ -8,9 +8,10 @@
8
8
  [HTML] ———————————————————————
9
9
  ```ここに言語を入力
10
10
  <span>
11
- <button class=change” id=changeID”>変更</button>
11
+ <button class="change” id="changeID”>変更</button>
12
- <button class=delete” id=deleteID”>削除</button>
12
+ <button class="delete” id="deleteID”>削除</button>
13
13
  </span>
14
+
14
15
  ```
15
16
  ————————————————————————————
16
17
 
@@ -23,8 +24,8 @@
23
24
  i === 0 ? changeEvent(e) : deleteEvent(e) ;
24
25
  }
25
26
 
26
- button.setAttribute(onclick, location.href=“#modal-chg01”);
27
+ button.setAttribute('onclick', 'location.href=“#modal-chg01”');
27
- button.setAttribute(onclick, location.href=“#modal-del01”);
28
+ button.setAttribute('onclick', 'location.href=“#modal-del01”');
28
29
 
29
30
  — 中略 —
30
31
  ```
@@ -35,9 +36,10 @@
35
36
  [HTML結果] —————————————————————
36
37
  ```ここに言語を入力
37
38
  <span>
38
- <button class=change” id=changeID” onclick=location.href=#modal-del01””>変更</button>
39
+ <button class="change” id="changeID” onclick='location.href="#modal-del01"'>変更</button>
39
- <button class=delete” id=deleteID” onclick=location.href=#modal-del01””>削除</button>
40
+ <button class="delete” id="deleteID” onclick='location.href="#modal-del01"'>削除</button>
40
- </span>
41
+ <span>
42
+
41
43
  ```
42
44
  ————————————————————————————
43
45
 

1

不要な記述の削除

2022/07/12 09:17

投稿

july2022
july2022

スコア10

test CHANGED
File without changes
test CHANGED
@@ -15,7 +15,7 @@
15
15
  ————————————————————————————
16
16
 
17
17
 
18
- [javascript] —————————————————————~~打ち消し線~~
18
+ [javascript] —————————————————————
19
19
  ```ここに言語を入力
20
20
  — 中略 —
21
21