Parse the prototype JQuery method to break out of the each loop

  • 2020-03-30 00:48:51
  • OfStack


function chk(){
        var flag=true;
        var msg='';
        var tips={'username':' The name ','tel':' The phone ','company':' The name of the company ','loupan_name':' Building name ','sdate':' A bulk of time ','content_1':' Bulk content '};
        $$('.required').each(function(el){
            if($F(el).blank()){
              msg+=' Please enter the '+tips[$(el).readAttribute('id')]+'!nn';
              flag=false;
              throw $break;
            }
        }
       return flag;
    }

Break out of each loop by throwing $break

  Used in Jquery

Return false;

Out of this loop, use continue


Related articles: