What is the correct way to get the current jQuery validator object for an existing form?
Note, the validator is being configured using the jQuery Unobtrusive validation plugin hence why I don't have a reference to it.
From documentation:
The validate method returns a Validator object
Next code will gets existing validator or init it
var validator = $("form_selector").validate();
You want:
var validator = $("#form_id").data("validator");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With