easyui -validatebox 驗證框加載
阿新 • • 發佈:2017-12-13
end easyui bottom options true easy ssa area xtend
問題:
easyui驗證狂框有時會驗證輸入字符的位數,或者驗證有效字符組合
解決:
使用easyui的驗證框,繼承驗證框,指定輸入框為驗證框即可
$(function(){ $.extend($.fn.validatebox.defaults.rules, { haha: { validator: function(value){ return /^\d{6}$/.test(value) ; }, message: ‘請輸入6位數字‘ }, tao: { validator:function(value){ return /^\d{7}$/.test(value) ; }, message: ‘請輸入7位數字‘ } }); });
使用方法:
<div style="margin-bottom:20px"> <label class="label-top">地區編碼:</label> <input class="easyui-textbox theme-textbox-radius easyui-validatebox" style="width:80%" value="" name="areaId" id="areaIdAdd" prompt="地區編碼(6位數字)" data-options="required:true,validType:‘haha‘" /> </div>
easyui -validatebox 驗證框加載