How to use jquery in layui

藏色散人
Release: 2023-01-13 00:40:16
Original
8924 people have browsed it

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

Another one:

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

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!

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