回答編集履歴

1

dom

2019/01/31 02:09

投稿

yambejp
yambejp

スコア114829

test CHANGED
@@ -43,3 +43,49 @@
43
43
  </section>
44
44
 
45
45
  ```
46
+
47
+ # dom処理
48
+
49
+ ```javascript
50
+
51
+ <script>
52
+
53
+ window.addEventListener('DOMContentLoaded', function(){
54
+
55
+ var li=document.createElement('li');
56
+
57
+ li.classList.add('adjust-box','box-1x2');
58
+
59
+ li.setAttribute('id','');
60
+
61
+ li.addEventListener('touchstart',function(){});
62
+
63
+ var div=document.createElement('div');
64
+
65
+ div.classList.add('inner');
66
+
67
+ var p=document.createElement('p');
68
+
69
+ document.querySelector('.todo_category ul').appendChild(li);
70
+
71
+ li.appendChild(div);
72
+
73
+ div.appendChild(p);
74
+
75
+ p.appendChild(document.createTextNode('test'));
76
+
77
+ });
78
+
79
+ </script>
80
+
81
+
82
+
83
+ <section class="todo_category">
84
+
85
+ <ul>
86
+
87
+ </ul>
88
+
89
+ </section>
90
+
91
+ ```