Loop call. If you have obtained the result, exit the loop. The following is a good example. If you are interested, you can try to operate it.
The Code is as follows:
Function checksdzt (){
Sdzt = $ ("# viewObj_zt_text"). val ();
// Loop call. If the result is obtained, exit the loop.
Loopgetinfo = setInterval ("checksdztsub ()", 50); // The call interval is 50 milliseconds.
}
Function checksdztsub (){
If ($ ("# viewObj_zt_text"). val ()! = "" & $ ("# ViewObj_zt_text"). val ()! = Sdzt)
{
If ($ ("# viewObj_zt_text"). val () = "locked ")
{
$ ("# Sdyydes" ).html ("* locking reason ");
$ ("# ViewObj_sdyy_text"). attr ("validate", "{required: true }");
}
Else if ($ ("# viewObj_zt_text"). val () = "normal ")
{
$ ("# Sdyydes" ).html ("locking reason ");
$ ("# ViewObj_sdyy_text"). attr ("validate ","");
}
Else
Sdzt = $ ("# viewObj_zt_text"). val ();
// ClearInterval (loopgetinfo); // terminate the loop
}
}