Answers for "on error jquery validation"

1

jquery validation errorplacement

$(document).ready(function () {
    $('#add_client').validate({
        errorClass: 'validation_errors',
        debug: false,
        rules: {
            client_name: {
                required: true
            },
            client_address: {
                required: true
            },
            client_city: {
                required: true
            }
        },
        errorPlacement: function (error, element) {
            console.log('dd', element.attr("name"))
            if (element.attr("name") == "client_city") {
                error.appendTo("#messageBox");
            } else {
                error.insertAfter(element)
            }
        },
        messages: {
            client_name: {
                required: "The Client name is a required / mandatory field"
            },
            client_address: {
                required: "The Client address is a required / mandatory field"
            },
            client_city: {
                required: "The City is a required / mandatory field"
            },

        },
        submitHandler: () => {
        $('#send_form').on('click', submitFormHandler)
        $('#send_form').trigger('click')
        $('#terms-of-use').removeClass("checked")
        $('#terms').removeClass("checked")
      }
    });
});
Posted by: Guest on May-28-2020

Code answers related to "on error jquery validation"

Code answers related to "Javascript"

Browse Popular Code Answers by Language