Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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")
      }
    });
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: phone number validation in yup 
Javascript :: react native hide stack navigator title 
Javascript :: syntax jquery 
Javascript :: chartjs how to disable animation 
Javascript :: pass csrf token in ajax laravel 
Javascript :: jquery select outer html 
Javascript :: mayoe que menor que 
Javascript :: uppercase string in js 
Javascript :: javascript padstart 
Javascript :: modal resetting when hide 
Javascript :: javascript listen for double click 
Javascript :: find a number that is closest to a specific number in javascript 
Javascript :: loop through checkboxes jquery 
Javascript :: token invalid discord bot 
Javascript :: empty select option jquery 
Javascript :: get all values checked checkboxes jquery 
Javascript :: pass header in ajax 
Javascript :: message.channel.fetchMessages is not a function 
Javascript :: jquery form id submit 
Javascript :: console.log object to json 
Javascript :: Emojis should be wrapped in <span, have role="img", and have an accessible description with aria-label or aria-labelledby 
Javascript :: install heroicons 
Javascript :: react native italic text 
Javascript :: js timer loop 
Javascript :: javascript setinterval 
Javascript :: event listener mousemove 
Javascript :: moment format date dd/mm/yyyy 
Javascript :: lerp javascript 
Javascript :: primera letra en mayuscula javascript 
Javascript :: detect if scrolled to bottom 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =