This time I will show you how to confirm whether jQuery is loaded, and what are the precautions for confirming whether jQuery is loaded. The following is a practical case, let's take a look.
A rather troublesome thing is that some plug-ins bind dom objects, and then use jq syntax. For example, when you use vue+node, you basically need Baidu methods
I provide an alternative solution. For example, if you download a carousel chart plug-in a.js
you open its a.js and then Use function lbt(){} to wrap the entire JS and add my paragraph in the head. It is basically ready to use.
isjQueryLoadend(); function isjQueryLoadend(){//判断JQ是否加载完成没有的话 继续判断 if (typeof $ != 'undefined' && document.body) {//jquery lbt(); } else { setTimeout(isjQueryLoadend,1000) } }
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
How to use webpack to write jquery environment configuration
There should be no response after ajax requests background data successfully. How to handle
jQuery EasyUI tab panel tabs Using
jQuery to add new elements to a dynamic list
The above is the detailed content of How to confirm whether jQuery is loaded. For more information, please follow other related articles on the PHP Chinese website!