search
HomeWeb Front-endLayui TutorialHow to use jquery in layui

How to use jquery in layui

Jan 19, 2021 am 09:36 AM
layui

How to use jquery in layui: 1. Use it through "layui.use('jquery', function(){var $=layui.$...}"; 2. Use it through "layui.use( ['form','layer']..." method is used.

How to use jquery in layui

The operating environment of this tutorial: Windows 7 system, layui version 2.5.6, Dell G3 computer .

Recommended: "layUI Tutorial"

layui is a framework based on jQuery, and it comes with jQuery, so how does layui use the internal jquery?

Here’s a note on how to use jQuery internally:

layui.use('jquery', function(){ 
  var $ = layui.$ //重点处
  
  //后面就跟你平时使用jQuery一样
  
});

Another one:

//如果内置的模块本身是依赖jquery,你无需去use jquery,所以上面的写法其实可以是:
layui.use(['form','layer'],function () {
            var $ = layui.$;
            var form = layui.form;
            var layer = layui.layer;
            }

Generally, just use the latter one

The above is the detailed content of How to use jquery in layui. 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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools