Home >Web Front-end >Layui Tutorial >How to use jquery in 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.
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!