Skip to content

Instantly share code, notes, and snippets.

@djaoka
Created April 15, 2014 10:31
Show Gist options
  • Save djaoka/10721264 to your computer and use it in GitHub Desktop.
Save djaoka/10721264 to your computer and use it in GitHub Desktop.
Breaking out of a PrototypeJS .each() loop
$$('.myClass').each(function(oElement){
if(oElement.getValue() == 'value'){
//Do something
}else{
//Leave the loop
throw $break;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment