asterocean wrote:
> for exzample:
>  
> $("[EMAIL PROTECTED]'text']").each(function(){if 
> (this.value==""){alert("error");this.focus();break;}});
>  
> but 'break;' won't stop the iteration of each, what should i do?

There was some discussion on this list of returning false
to break the loop - but I'm not sure if that has been
implemented yet - does anyone know?

$("[EMAIL PROTECTED]'text']").each(function() {
     if (this.value=="") {
         alert("error"); this.focus();
         return false;
     }
});

Otherwise, you can throw an exception:

try {
     $("[EMAIL PROTECTED]'text']").each(function() {
         if (this.value=="") {
             alert("error"); this.focus();
             throw true; // The actual value here is arbitary
         }
     });
} catch(e) {}

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to