lundi 5 février 2018

jQuery validate a checkbox is ticked - Is there a way to get the error message to append the HTML rather than prepend?

I am implementing jQuery validate onto a form I have, specifically the required method

The issue I am having is that the error message prepends the HTML value that the checkbox has, like so;

When you go to submit the form and you do not have the checkbox ticked, the error message "skews" the label to one side.

This is the checkbox before the validation error:

enter image description here

I've looked into errorContainer but can not currently get it to work within a 'rules' tag, like so:

rules : {
        agreeBranchRules: {
            required: true,
            errorContainer: "#putErrorMessageHereSoItDoesntSkew"
         }
    }

Is there a way to "catch" that validation error and place it below it, not causing it to skew the "I agree" value tag?




Aucun commentaire:

Enregistrer un commentaire