回答編集履歴

1

外だしサンプル

2018/05/01 08:47

投稿

m.ts10806
m.ts10806

スコア80850

test CHANGED
@@ -17,3 +17,59 @@
17
17
  外だしされたほうが良いかと思いますし、もしそのままonclick=""内で利用するのであれば、"がかぶっていますので正しく処理が読みこれませんね。
18
18
 
19
19
  'に変えるなど正しく認識させる対応が必要です。
20
+
21
+
22
+
23
+ # 外だしサンプル
24
+
25
+
26
+
27
+ ```html
28
+
29
+ <a href="/check_model?page=requests&model={{request.model_id}}&request={{request.id}}"
30
+
31
+    onClick='test("{{request.id}}")'>{{request.request_name}}</a>
32
+
33
+
34
+
35
+ ```
36
+
37
+ ```js
38
+
39
+
40
+
41
+ function test(requestid){
42
+
43
+ document.getElementById("div_link_"+requestid).style="display: none";
44
+
45
+ document.getElementById("div_dummy_"+requestid).style="";
46
+
47
+ }
48
+
49
+ ```
50
+
51
+ ※実際はtestではなく処理名や機能名をきちんとつけてください。
52
+
53
+
54
+
55
+
56
+
57
+ というか組んでて気づいたんですが、
58
+
59
+
60
+
61
+ ```html
62
+
63
+ <a href="/check_model?page=requests&model={{request.model_id}}&request={{request.id}}"
64
+
65
+    onClick='document.getElementById("div_link_{{request.id}}").style="display: none";
66
+
67
+  document.getElementById("div_dummy_{{request.id}}").style="";'{{request.request_name}}</a>
68
+
69
+ ```
70
+
71
+
72
+
73
+ <a>の > ←これ、ないですね。
74
+
75
+ そこが原因だったりして。