回答編集履歴
1
chousei
test
CHANGED
@@ -2,3 +2,19 @@
|
|
2
2
|
おそらくnullになっています。
|
3
3
|
つまりclinic_infoというクラスの付いたHTML要素が設定されていないのでしょう
|
4
4
|
|
5
|
+
動作確認用
|
6
|
+
```javascript
|
7
|
+
<script>
|
8
|
+
window.addEventListener('DOMContentLoaded', () => {
|
9
|
+
let url = location.pathname;
|
10
|
+
if (url !== "acces.html") {
|
11
|
+
const targetElement = document.querySelector('.clinic_info');
|
12
|
+
const elm = document.createElement('div');
|
13
|
+
elm.classList.add('js-mt70');
|
14
|
+
elm.textContent="test";
|
15
|
+
targetElement.insertAdjacentElement('beforebegin',elm);
|
16
|
+
}
|
17
|
+
});
|
18
|
+
</script>
|
19
|
+
<div class="clinic_info">clinic_info</div>
|
20
|
+
```
|