title: Multiple If with Regex
body: <p>I have a little problem with if and regex and don't found my mistake :-(</p>
  
  <p>On submit i have a each to loop through all input fields (works)</p>
  
  <p>Then a have a if on all input fields where is "von" in the name.</p>
  
  <p>The first part if there no chars in it works great (standalone) the other with the regex doesn't work :-(</p>
  
  <p>So the if should be run when nothing is in the field and when the format doesn't meets the 24h time format 00:00 or 09:30 ...</p>
  
  <p>So the red border should be visible when there is nothing in the field and when the input doesn't meets the 24h time format.</p>
  
  <p>Now it runs every time with the right and the false input :-(</p>
  
  <p>The Code:</p>
  
  <pre><code>$(submit1).click(function (e) 
  {
      e.preventDefault();
  
      var regtime = /([01]?[0-9]|2[0-3]):[0-5][0-9]/;
  
      $("input").css({"border": "1px solid #bbb"});
  
      $("input").each(function(index) {
  
          if($('input[name$="[von]"]').val() == '' || (!regtime.test($('input[name$="[von]"]'))))
          {
              $('input[name$="[von]"]').css({"border": "solid", "border-color": "red"});
          }
      });
  });
  </code></pre>
  
  <p>THANK YOU !</p>