开发者

How to load jQuery if it's not already loaded?

I'm working on a weather widget, so in order to optimize it i want to check if jQuery has been loaded in the page, if Not, the widget will load it from my website. Because not all the websites use jQuery. how to do that?

Example of how to put my widget:

<h开发者_StackOverflow社区tml>
blah blah blah
.................
<script src="http://www.xxx.com/weather.js"></script>
</body>
</html>

Thank you


if (typeof window["jQuery"] == "undefined"){

  // no jquery

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜