jQuery .validate() function provides "onsubmit" option to perform custom action before validation.
By default it is set to true.
I have used it in my project and it works very well.
$(".selector").validate({
onsubmit: function(){
CKEditorUpdate();
return true;
},
rules:{
title:{required:true},
content:{required:true}
},
messages:{
title:{required:"Please enter a title"},
content:{required:"Please enter some content"}
},
submitHandler : function(form){
});
function CKEditorUpdate() {
for (instance in CKEDITOR.instances)
CKEDITOR.instances[instance].updateElement();
}
This is a cleaner and much easier to understand approach.
Refer http://jqueryvalidation.org/validate#onsubmit