[jQuery] EqualTo but only if checkbox is checked

[jQuery] EqualTo but only if checkbox is checked


How can I compare 2 text fields only if a certain checkbox is
checked? Can you do something like this?
billingAddress: {
    required: true
    minlength: 5
    equalTo: "#shippingAddress" && function(element) {
return jQuery("#comparefields").is(":checked");
},
I'm not sure if this is possible or how to form this correctly. I
assume you'd be able to do this in an equalto along with specifying
which field to compare to.