layui 单选框、多选框radio 元素判断是必填项 lay-verify='required'

简单验证复选框,单选框必填

例子代码:




  "utf-8">
  layui
  "renderer" content="webkit">
  "X-UA-Compatible" content="IE=edge,chrome=1">
  "viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  "stylesheet" href="//res.layui.com/layui/dist/css/layui.css"  media="all">
  


      
 
class="layui-elem-field layui-field-title" style="margin-top: 50px;"> 初始赋值演示
class="layui-form" action="" lay-filter="example">
class="layui-form-item">
class="layui-input-block"> "checkbox" name="like" lay-skin="primary" lay-verify="otherReq" title="写作"> "checkbox" name="like" lay-skin="primary" lay-verify="otherReq" title="阅读"> "checkbox" name="like" lay-verify="otherReq" title="游戏">
class="layui-form-item">
class="layui-input-block"> "radio" name="sex" value="" lay-verify="otherReq" title="" > "radio" name="sex" value="" lay-verify="otherReq" title="">
class="layui-form-item">
class="layui-input-block">

注意:

所有单选和多选这里都是要设置成一样子:lay-verify="otherReq"

 

转载于:https://www.cnblogs.com/bluealine/p/11596505.html

你可能感兴趣的:(layui 单选框、多选框radio 元素判断是必填项 lay-verify='required')