layui怎么赋值和获取form表单

layui怎么赋值和获取form表单,下面织梦云小编为您解答: 有如下layui表单: form class="layui-form" action="" lay-filter='testForm'  div class="layui-form-item"    label class="layui-form-label"账号/label    div class="layui-input-block"      input type="text" name="username" class="lay

layui怎么赋值和获取form表单,下面织梦云小编为您解答:
有如下layui表单:
<form class="layui-form" action="" lay-filter='testForm'>
  <div class="layui-form-item">
    <label class="layui-form-label">账号</label>
    <div class="layui-input-block">
      <input type="text" name="username" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">密码框</label>
    <div class="layui-input-inline">
      <input type="password" name="pass" class="layui-input">
    </div>
  </div>
</form>
获取表单的所有值:
let data = layui.form.val(`testForm`);
console.log("

本文标题为:layui怎么赋值和获取form表单

基础教程推荐