I’m using the jQuery validation plugin on a form loaded via ajax.
For whatever reason, it isn’t working. Is there something special I need to do b/c it’s loaded after js is initialized? Any ideas?
Edit:
Using the code from the plugin site:
$().ready(function() {
// validate the comment form when it is submitted
$("form").validate();
});
When you load a form via AJAX, you can’t use a
readyevent, because that only runs when the page initially loads. Instead, use the loaded callback, e.g.:This ensures
validate()is called after the AJAX call returns.