layui与jQuery一起使用
1,先导入jquery
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
2,导入layui组件
<link rel="stylesheet" type="text/css" href="__STATIC__/plug/layui/css/layui.css">
<script type="text/javascript" src="__STATIC__/plug/layui/layui.js"></script>
应用实例
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="__STATIC__/plug/layui/css/layui.css"> <script type="text/javascript" src="__STATIC__/plug/layui/layui.js"></script> </head> <body> <button class="layui-btn layui-btn-primary" onclick="demo()">按钮一个</button> </body> <script> layui.use('layer', function(){ var layer = layui.layer; }); function demo(){ layer.alert('你好'); $('body').append('hello jquery'); } </script> </html>