1. 程式人生 > >layui與jQuery一起使用

layui與jQuery一起使用

http button javascrip stat hello har div () layui

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>

layui與jQuery一起使用