1

I have created a custom input on the checkout page, I want to add date validator from js but I can't.

I already tried this custom js:

$( "#co-shipping-method-form" ).validate({
    rules: {
        myinputname: {
            required: true,
            date: true
        }
    }
});

and this one also.

jQuery('#co-shipping-method-form').formValidation({
    fields: {
        myinputname: {
            validators: {
                notEmpty: {
                message: 'The date of birth is required'
            },
            date: {
                format: 'DD/MM/YYYY',
                message: 'The date of birth is not valid'
            }
        }
    }
})

Does anyone know what is the proper way to do this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.