Very strange behaviour after regex-test ?

Very strange behaviour after regex-test ?

Hi guys,
I got a very strange behaviour and I really want to know why it does what it does. This is the page:

Please remove the"-" signs and use the correct protocol:
yttp://p-r-o-f-o-r-m-a.s-c-i-e-n-c-e-a-n-d-m-o-t-i-o-n.com

From line 189 to 193 on this page I simply want to color the content of a <label>-tag in red if the email-field was not correct. works fine in all browsers I tested.
  1. 		// Test if valid email
    		if(!regex.test($('input[name="email"]').val())) {
    			flag = false;
    			emailregex = false;
    		}

If you look into the code before these lines there are several ".each(function() { ......... " statements. And now comes what I absolutely don't understand: When I move this piece of code in front of (before) the first ".each(function () { ......"-code-block it simply does not work. But I really didn't know why. I have no clue. I moved and tested this code between line 202, 199, 194 and 190.

Initial my intention was to integrate this piece of code directly to line 190,191 and 192. What do I miss? In the last years, I got into these strange behaviours in completely different projects when I have used jquery.

Thanks for your time.