Welcome to Technical Exchange. qq:138986722
Recently in the old project to verify that the text box is a number, cannot be empty, can not repeat these things.
When I do a good job, I suddenly found that each text box with the management onblur () event to trigger the validation, the result entered the dead loop.
Closing the page has to be done with the process (or right-click off) ...
Okay, no more nonsense, talk about the solution first:
Multiple text boxes are treated with a onblur method, if else structure is used
function Prmecnoteonblur () {var Prmec = jQuery ("#groupNum"). Val ();
var PRM = jQuery ("#prmBillNo"). Val ();
var servicenum = jQuery (' #serviceNum '). Val (); if (Prmec==null | |
prmec== "") {jQuery (' #prmecNote '). html (' <font color= ' red ' >prmec number cannot be empty </font> ');
JQuery (' #groupNum ') [0].focus ();
return false; else if (Prm==null | |
prm== "") {jQuery (' #prmecNote '). HTML ("");
JQuery (' #prmNote '). html (' <font color= "Red" >PRM billing number cannot be empty </font> ');
JQuery (' #prmBillNo ') [0].focus ();
return false; }else if (Servicenum = = "" | |
Servicenum = = null) {jQuery (' #prmNote '). HTML (""); JQuery (' #serNote '). html (' <font color= ' red ' > Service number is not allowed to be empty, please enter the service number.
</font> ');
JQuery (' #serviceNum '). Select ();
return false;
}else if (servicenum!= "") {jQuery (' #serNote '). HTML (""); return Chekservicenum ();
Verify non-repeatable methods}else{//Empty error hints JQuery (' #prmecNote '). HTML ("");
JQuery (' #prmNote '). HTML ("");
JQuery (' #serNote '). HTML ("");
return true; }
This will be called at the time of submission:
if (!prmecnoteonblur ()) {return
;
}
Being go ... Eat rice bird ...