Layui 获取表单提交数据
HTML
<div class="layui-card-header layuiadmin-card-header-auto"> <form class="layui-form"> <div class="layui-form-item"> <div class="layui-inline"> <label class="layui-form-label">公司名:</label> <div class="layui-input-inline"> <input name="keyword" id="keyword" class="layui-input"> </div> </div> <div class="layui-form-item layui-inline"> <button class="layui-btn" lay-submit lay-filter="formDemo">搜索</button> </div> </div> </form> </div>
JS
form.on('submit(formDemo)', function (data) { console.log(data.field); return false; });