How to determine if jQuery is running on a page (even if jQuery is /after/ the detection script)

后端 未结 3 569
再見小時候
再見小時候 2021-02-08 19:04

I\'m working on a do-dad that can be embedded in a page like a youtube video. The particular effect I want needs jQuery to work.

I want to load jQuery on the condition t

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-08 19:55

    You can use window.onload. This fires after domReady, so jQuery would surely be loaded by this point.

    And check for jQuery, not $. Sometimes people use jQuery with other libraries and use $ for something different.

    However, IMHO, I don't think it's a big deal if jQuery gets loaded twice.

提交回复
热议问题