title: I am trying to validate jsp login form,I need field (label) validation instead of alert message
body: <p>Here is my javascript:</p>
  
  <pre><code>function checkEmail() {
  
      var email = document.getElementById('mLoginName');
  
  
      var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})|([0-9]{10})+$/;
  
  
      if (!filter.test(email.value)) {
          alert("Please enter valid email id or 10 digit mobile number");
          email.focus();
          return false;
      }
  }
  </code></pre>
  
  <p>HTML Code:</p>
  
  <pre><code>&lt;form:form method="post" onsubmit="return checkEmail();" action="SignIn"  modelAttribute="memberBean" &gt;
      &lt;form:input type='hidden' name='mode' id='mode' path='mode' /&gt;
      &lt;form:input type='text'  class="input" name='mLoginName'  id='mLoginName' path='mLoginName' onblur="checkInp()" placeholder='Email/Mobile' /&gt;
  
  &lt;input type='submit' class="submit" value='SignIn/SignUp' &gt;
  &lt;/form:form&gt;
  </code></pre>