$("#inputForm").validate({}) 是在什么时候会被执行?
以下代码中
<script type="text/javascript">
var validateForm;
var $table; // 父页面table表格id
var $topIndex;//弹出窗口的 index
function doSubmit(table, index){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
var mobileFlag = $(':radio[name="mobileFlag"]:checked').val();
$("#mobileFlag").val(mobileFlag);
if(validateForm.form()){
$table = table;
$topIndex = index;
$("#inputForm").submit();
return true;
}
return false;
}
$(document).ready(function() {
$("#value").focus();
var $inp = $('input:text');//获取所有的输入框(包括不可编辑)
$inp.bind('keydown', function (e) {
var key = e.which;
if (key == 13) {//13为enter键
e.preventDefault();//取消enter默认状态
var nxtIdx = $inp.index(this) + 1;
var readonly = $(":input:text:eq(" + nxtIdx + ")").prop("readonly");//获取下一焦点的状态
while(readonly){//当下一焦点为不可编辑状态时跳过改焦点
nxtIdx = nxtIdx+1;
readonly = $(":input:text:eq(" + nxtIdx + ")").prop("readonly");
if(!readonly){
break;
}
}
$(":input:text:eq(" + nxtIdx + ")").focus();
}
});
validateForm = $("#inputForm").validate({
submitHandler: function(form){
jp.loading();
$.post("${ctx}/em/emHouseOwner/save", $('#inputForm').serialize(),function(data){
if(data.success){
$table.bootstrapTable('refresh');
jp.success(data.msg);
}else{
jp.error(data.msg);
}
jp.close($topIndex);//关闭dialog
});
},
rules:{
mobile: {
required:true,
minlength:11,
isMobile:true,
remote: {
url:"${ctx}/em/emHouseOwner/check?oldMobile="+
encodeURIComponent("${equm.mobile}"),
cache:false
}
}
},
messages: {
mobile:{
required : "请输入手机号",
minlength : "确认手机不能小于11个字符",
isMobile : "请正确填写您的手机号码",
remote: "手机号已存在"
}
},
errorContainer: "#messageBox",
errorPlacement: function(error, element) {
$("#messageBox").text("输入有误,请先更正。");
if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
error.appendTo(element.parent().parent());
} else {
error.insertAfter(element);
}
}
});
});
</script>
以上代码中
1、$(":input:text:eq(" + nxtIdx + ")") 中的 eq(" + nxtIdx + ") 是什么意思?
2、var mobileFlag = $(':radio[name="mobileFlag"]:checked').val() 后的 .val() 是什么意思?
3、validateForm.form() 中的 .for() 是什么意思,没有看查到这个函数定义的地方呀?
4、$(":input:text:eq(" + nxtIdx + ")").prop("readonly") 中的 .prop("readonly") 是什么意思?
5、validateForm = $("#inputForm").validate({}) 中的 $("#inputForm").validate({}) 是在什么时候会被执行?