Using Jquery 1.8.0 return false is not breaking an each() loop

Posted by user1879729 on Stack Overflow See other posts from Stack Overflow or by user1879729
Published on 2012-12-05T16:29:46Z Indexed on 2012/12/05 17:04 UTC
Read the original article Hit count: 113

Filed under:
|
|
|

Here is the script I am using.

    $('.row').each(function(){
        $(this).each(function(){
            if($(this).find('.name').val()==""){

                $(this).find('.name').val(data.name);
                $(this).find('.autonomy').val(data.autonomy);
                $(this).find('.purpose').val(data.purpose);
                $(this).find('.flow').val(data.flow);
                $(this).find('.relatedness').val(data.relatedness);
                $(this).find('.challenge').val(data.challenge);
                $(this).find('.mastery').val(data.mastery);
                $(this).find('.colour').val(data.colour);
                done=true;
            }
            if(done==true){
                alert("here");
                return false;
            }
        });
    });

It just seems to totally ignore the return false and I can't seem to work out why!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about loops