**easyui版本:1.4.1
組件:numberbox**ui
在使用numberbox的isvalid方法時,老是返回true。code
<input id="phone" type="text" style="border: 1px solid #8DB2E3; width:80px; height:20px"> $("#phone").numberbox({ width: 100, precision: 0, novalidate: false, validType: "phoneRex", tipPosition: "right", required:true }); //自定義驗證:手機格式 $.extend($.fn.validatebox.defaults.rules, { phoneRex: { validator: function(value){ var rex=/^(13|15|18|17|19)\d{9}$/; return rex.test(value); }, message: "請輸入正確的手機格式" } });
$("#phone").numberbox("disable"); var isValid = $("#phone").numberbox("isValid");//無論格式正不正確,都返回true
var isValid = $("#phone").numberbox("isValid"); $("#phone").numberbox("disable");
發現isValid能正常驗證格式。ip
在使用isValid的方法以前,不能讓組件處於禁用狀態。ci