S
S
sasha_jarvi2019-01-14 13:14:20
css
sasha_jarvi, 2019-01-14 13:14:20

How to display error messages using jquery Validate?

I have the following code to validate inputs:

$('.refresh').click(function() {
                $('.price-filter').validate({
                    rules: {
                        price: {
                            required: true,
                            number: true
                        }
                    },

                    messages: {
                        price: {
                            required: "Поля ввода не должны быть пустыми",
                            number: "Введите цифры"
                        }
                    },

                    errorElement: "div",

                    errorPlacement: function(error, element) {
                        $('.error').insertAfter('.price-filter');
                    },

                    submitHandler: function() {
                        table.draw();
                    }

                })
            });

At first glance, everything is configured correctly, but no error messages are displayed. How to fix it? Thanks in advance.
The complete code is here: https://jsfiddle.net/zu2yhmvx/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sasha_jarvi, 2019-01-14
@sasha_jarvi

Problem solved: https://jsfiddle.net/zu2yhmvx/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question