Check if Javascript script exists on page

后端 未结 7 760
深忆病人
深忆病人 2021-02-02 10:16

I have a bookmarklet that I\'ve made and it loads a script from my server onto the users current page. However I have an if check in my script that if a condition is not met the

7条回答
  •  猫巷女王i
    2021-02-02 10:53

    if (document.getElementById('element-id')) {
    // if exist must do something }
    

    hi, this is worked for me, plesea try it if you still need it

提交回复
热议问题