Home > Web Front-end > JS Tutorial > How to confirm whether jQuery is loaded

How to confirm whether jQuery is loaded

php中世界最好的语言
Release: 2018-03-15 16:05:43
Original
1658 people have browsed it

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)
	}
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template