Jquery- on Form Submit Validate

On Form Submit Validate using Jquery

<script type="text/javascript"> 
$(document).ready(function()
{ 
    $("#shr_form").on('submit', function()
    { 
       var dForm = $(this); 
       var damount  = dForm.find("input[name=damount]").val(); 
       var dMsgElmnt= dForm.find("#dmessage");
 
       dMsgElmnt.html(''); 
       dMsgElmnt.css('color',''); 

       if(damount=="") { 
          dMsgElmnt.css('color','red');
          dMsgElmnt.html("Please Enter a Minimum Amount."); 
          return false; 
       }else{ 
          var r = confirm("Do you want to submit?"); 
          if (r == true) 
          {     
             return true; 
          } else {    
              return false; 
          } 
       } 
    }) 
});
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *