layui 批量对 form 中元素赋值 == form.val()

< form class=“layui-form layui-form-pane” lay-filter=“formTest”>
< class=“layui-form-item”>
  < label class=“layui-form-label”>请填写描述< /label>
  < div class=“layui-input-block”>
  < textarea name=“desc” type=“text” placeholder=“请输入内容” class=“layui-textarea”>< /textarea>
< /div>
< div class=“layui-inline”>
  < label class=“layui-form-label”>日期< /label>
  < div class=“layui-input-inline”>
  < input name=“date” class=“layui-input” type=“text” required verify=“date”>
< /div>
< /form>

< script type=“text/javascript”>

layui.use(['form','jquery','layer'],function(){
	var form = layui.form;
	var $ = layui.jquery;
	
	$(function(){
		//alert(JSON.stringify(form.val("formTest")));
		form.val("formTest",{
			"desc": "layui_",
			"date":"2020-05-14"
		});
	});
});

< /script>

你可能感兴趣的:(layui 批量对 form 中元素赋值 == form.val())