easyUI中numberbox的校验

例:两个numberbox(A,B),其中两个都为必填项,要求在文本框显示红色,来显示其是必填项,其中只有当A填完之后,在能允许B进行填写,否则给出提示框,并清空其中的数据
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>textbox&numberbox</title>
<link rel="stylesheet" href="../EasyUI/themes/default/easyui.css">
<link rel="stylesheet" href="../EasyUI/themes/icon.css">
<script src="../EasyUI/jquery.min.js"></script>
<script src="../EasyUI/jquery.easyui.min.js"></script>
</head>
<body>
<!--numberbox的校验-->
<input type="text" class="easyui-validatebox" required="true" id="A"/>
<input type="text" class="easyui-validatebox" required="true" id="B" data-options="disabled:true"/>
<script type="text/javascript">
$("#A").numberbox({
onChange:function (newValue) {
if(newValue!=null){
$("#B").numberbox({
disabled:false
})
}
}
})
</script>
</body>
</html>
原文地址:https://www.cnblogs.com/fanxijiang/p/8287202.html