<script type="text/javascript">
Var validateForm;
Var $table;//parent page table form id
Var $topIndex;//pop-up window index
Function doSubmit (table, index) {//callback function, in the edit and save gesture, for openDialog call form is submitted,
Var mobileFlag=$(' : radio [name="mobileFlag"] : checked '). The val ();
$(" # mobileFlag "). Val (mobileFlag);
If ( validateForm. The form () {
)$table=table;
$topIndex=index;
$(" # inputForm "). The submit ();
return true;
}
return false;
}
The $(document). Ready (function () {
$(" # value "). The focus ();
Var $inp=$(' input: text);//get all the input box (including an editor)
$inp. Bind (keydown, function (e) {
Var key=e.w hich;
If (key==13) {//13 to enter
E.p reventDefault ();//cancel the enter default state
Var nxtIdx=$inp. Index (this) + 1;
Var readonly=$(" : input: text: eq (" + nxtIdx + ") "). The prop (" readonly ");//get the next focus of state
While (readonly) {//the moment a focus for an editor state skip change focus
NxtIdx=nxtIdx + 1;
Readonly= $(" : the input text: eq (" + nxtIdx + ") "). The prop (" readonly ") ;
if(! Readonly) {
break;
}
}
$(" : the input text: eq (" + nxtIdx + ") "). The focus ();
}
});
validateForm=$(" # inputForm "). The 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);//close the dialog
});
},
Rules: {
Mobile: {
Required: true,
Minlength: 11,
IsMobile: true,
Remote: {
Url: "${CTX}/em/emHouseOwner/check? OldMobile="+
EncodeURIComponent (" ${equm. Mobile} "),
Cache: false
}
}
},
Messages: {
Mobile: {
Required: "please enter a phone number,"
Minlength: "confirm the mobile phone can not be less than 11 characters,"
IsMobile: "please fill in your correct phone number,"
Remote: "the phone number is"
}
},
ErrorContainer: "# messageBox,"
ErrorPlacement: function (error, element) {
$(" # messageBox "). The text (" input is wrong, please correct, ");
If (element) is (" : the checkbox ") | | element, is (" : the radio ") | | element, the parent () is (" input - append ")) {
Error. AppendTo (element. The parent (). The parent ());
} else {
Error. InsertAfter (element);
}
}
});
});
</script>
in the above code
1, $(" : the input text: eq (" + nxtIdx + ") ") in eq (" + nxtIdx + ") is what mean?
2, var mobileFlag=$(' : radio [name="mobileFlag"] : checked '). Val. (after) the val () is what mean?
3, validateForm. The form of (). For () is what meaning, no check to the function definition?
4, $(" : the input text: eq (" + nxtIdx + ") "). The prop (" readonly "). The prop (" readonly ") is what mean?
5, validateForm=$(" # inputForm "). The validate ({}) in $(" # inputForm "). The validate ({}) is in when be executed?
CodePudding user response:
1, $(" : the input text: eq (" + nxtIdx + ") ") in eq (" + nxtIdx + ") is what mean?=& gt; P1: input: "text", the subscript starting from 0
2, var mobileFlag=$(' : radio [name="mobileFlag"] : checked '). Val. (after) the val () is what mean?
=& gt; [name="mobileFlag"] radio item is selected the value of the
3, validateForm. The form of (). For () is what meaning, no check to the function definition?
=& gt; So I didn't see
4, $(" : the input text: eq (" + nxtIdx + ") "). The prop (" readonly "). The prop (" readonly ") is what mean?
=& gt; Get the read-only property, setting: prop (' readonly '! 0);
5, validateForm=$(" # inputForm "). The validate ({}) in $(" # inputForm "). The validate ({}) is in when be executed?
=& gt; This should be the form validation plug-in, should you above: if (validateForm. The form ()) was carried out at this moment
And then: what baidu or other, keywords: jquery manual in Chinese