views:

57

answers:

1

Below is the code, I get an error which says that submitHandler is an invalid label

 $(document).ready(function() { 
    $("#withdraw").validate({ 
            rules: { 
             amount: {
                required: true,
                 number:true,
                 min:0,
                 max:<?php echo $balance; ?>

            } ,
            bank:{
                required:true,

            },
            cardnumber1: {
                required: true,
                 minlength:8

            },
           cardnumber2:{
              required:true,
              equalTo: "#cardnumber1"
             },
              holder:{
              required:true,
            }
      }
    }),
       submitHandler: function(form){
           var answer = confirm("Do you really want to withdraw this amount of money from your account?")
        if (answer){
            form.submit();
        }
        else{
            return false;
        }   
      }
    }); 

How to solve this problem?

A: 

You have an extra closing brace and parent here, just before submitHandler, this: }), should just be: , The brace before it closes the rules object.

Nick Craver