Try   HackMD

在樣板字串中無法執行document.querySelector

一般來說,樣板字串的規格如下

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

這個指令console.log出來變數一樣正常
但是就是無法執行
以下是解決方法
document.querySelector('.id'+product_id+'').click();
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

tags: JS 樣板字串