jquery each prevent alert from looping
<p>Take a look on this code first. Example I have 5 input fields that has required class.</p>

<pre><code>var errMsg = "This is required!"

$(function() {
   $(".required").each(function() {
      if($(this).val() == "" || $(this).val == errMsg) {
         $(this).val(errMsg);
      }
      else {
         alert("This should alert once");
      }
   });
}
</code></pre>

<p>I know that if the field has value, it will alert 5 times. How can I prevent it? How can I alert it once? I already use</p>

<pre><code>event.stopImmediatePropagation
event.preventDefault
</code></pre>
