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

How to tell whether jQuery is loaded

亚连
亚连Original
2018-06-22 14:27:582114browse

The editor below will share with you a solution to determine whether jQuery has been loaded. If it is not completed, continue to determine. It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor and take a look.

A rather troublesome thing is that some plug-ins bind dom objects and then use jq syntax. For example, when you are in vue node, you basically need Baidu method

I provide an alternative solution. For example, if you download a carousel plug-in a.js

you open its a.js and then use function lbt(){} wraps the entire JS in the head and adds my paragraph, it is basically ready to use.

isjQueryLoadend();
function isjQueryLoadend(){//判断JQ是否加载完成没有的话 继续判断
	if (typeof $ != 'undefined' && document.body) {//jquery
		lbt();
	} else { 
		setTimeout(isjQueryLoadend,1000)
	}
}

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

About JS sorting algorithm summary

About js event loop mechanism (detailed tutorial)

How to use javascript to realize QQ space photo album display

How to customize PC WeChat scan code login

About jade template Details of using the engine

About JS Hill sorting algorithm (detailed tutorial)

How to merge vue2.0 and animate.css together Usage (detailed tutorial)

How to convert a character into an integer in C

#What are the commonly used UIs in vue2.0 Library?

About JS sorting algorithm summary

How to make a cone using JS canvas

In vue- How to implement lazy loading of routes in router

How to implement breakpoint debugging of ts files in Angular2

The above is the detailed content of How to tell whether jQuery is loaded. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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