html
<input type="text" name="year" autocomplete="off" placeholder="请输入年" class="layui-input" lay-verify="required|number|year">
<input type="text" name="month" autocomplete="off" placeholder="请输入月" class="layui-input" lay-verify="required|number|month">
<input type="text" name="day" autocomplete="off" placeholder="请输入日" class="layui-input" lay-verify="required|number|day">
js
form.verify({
year:[/^(1949|19[5-9]\d|20\d{2}|2100)$/, '只能是数字且范围1949~2100!'],
month:[/^0?[1-9]$|^1[0-2]$/, '只能是数字且范围1~12!'],
day:[/^([1-9]|[1-2][0-9]|3[0-1])$/, '只能是数字且范围1~31!'],
});
网友评论