Skip to content
Loading
+2
  • Sachin Singh
    +1
    @varun ,your solution causes to refresh the page for submitting the form
    +1
  • Laxmidhar Sahoo
    +1
    Hi 
     
    Try the bellow code may solve
     
    $(function() {
    $("#submit-btn").click(function() {
    // validate and process form here
    });
    });
     
    +1
  • Darshan Shah
    +1
    We should use normal button instead of Submit to work HTML 5 Validation.  
    1. <form>  
    2.   <label for="name">Please enter your name (mandatory)label>  
    3.   <input id="name"  required>  
    4.   <button>Submitbutton>  
    5. form>  
     
    1. input:invalid {  
    2.   border: 1px solid red;  
    3. }  
    4.   
    5. input:invalid:required {  
    6.   background-image: background-color: #eee;  
    7. }  
    8.   
    9. input:valid {  
    10.   border: 1px solid green;  
    11. }  
      
    +1