title: How to show particular textbox border red color if i enter invalid email or blank in javascript?
body: <p>I have been created four email textboxes and also "more" link.</p>
  
  <p>If i click more link, it shows one more textbox at each link.</p>
  
  <p>Now i am struggling with show error status when i enter invalid email or blank field. 
  Here is my code:</p>
  
  <pre><code>&lt;input onclick="ValidateEmail()" style="float:right;" id="nextbutton" name="" type="submit" value="Next" /&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>var container = $(document.createElement('div')).css({
              padding: '5px', margin: '0'});
  
          $(container).append('&lt;input type=text class="input" id="tb1" placeholder="Email" /&gt;');
          $(container).append('&lt;input type=text class="input" id="tb2" placeholder="Email" /&gt;');
          $(container).append('&lt;input type=text class="input" id="tb3" placeholder="Email" /&gt;');
          $(container).append('&lt;input type=text class="input" id="tb4" placeholder="Email" /&gt;');
          $('#main').before(container);   // ADD THE DIV ELEMENTS TO THE "main" CONTAINER.
  
          var iCnt = 4;
  
      function IsValidEmail(email) {
                  var expr = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
                  return expr.test(email);
              };
              function ValidateEmail() {
                  var email = document.getElementById("tb1").value;
                  if (!IsValidEmail(email)) {
                      document.getElementById('tb1').style.border = "solid 1px red";
                    return false;
              }
  </code></pre>
  
  <p>I need to show red color textbox, in which particular filed is blank or invalid email.</p>
  
  <p>May i know, how can i achieve this one?</p>