I have a problem using validation plugin 1.2.1 and jquery 1.2.3

Every time the user clicks submit, the script adds a new error
element, leaving the previous one, so I end up with error elements
stacking up one after another. Also, the script doesn't remove the
error if user fills the field correctly and then moves on to the next
one

Here is my code:

<script type='text/javascript'>
              $().ready(function() {
                $('#signupform').validate({
                    errorElement: 'div',
                                rules: {
                                        name: {
                                                required: true,
                                                minlength: 2
                                        },
                                        email: {
                                                required: true,
                                                email: true
                                        },
                                        phone: {
                                                required: true,
                                        }
                                },

                                messages: {
                                        name: {
                                                required: 'Please enter your 
name',
                                                minLength: 'Your name must 
consist of at least 2
characters'
                                        },
                                        email: 'Please enter a valid email 
address',
                                        phone: 'Please enter your phone number'
                                }
                        });
                $('input.phone').mask('(999) 999-9999',
{placeholder:'_'});
               });
            </script>

Reply via email to