質問するログイン新規登録

回答編集履歴

1

chousei

2021/07/30 08:46

投稿

yambejp
yambejp

スコア118147

answer CHANGED
@@ -2,7 +2,7 @@
2
2
  <script>
3
3
  const shop={id:123};
4
4
  window.addEventListener('DOMContentLoaded', ()=>{
5
- [...document.querySelectorAll('img')].forEach(x=>{
5
+ document.querySelectorAll('img').forEach(x=>{
6
6
  const src=x.getAttribute('src');
7
7
  if(/\{shop.id\}/.test(src)){
8
8
  x.setAttribute('src',src.replace('{shop.id}',shop.id));