I am trying to validate a textarea (CK Editor) using jQuery validation and it is not working in button click event. Whereas it is working if called separately.
Fiddler: http://jsfiddle.net/BmZ93/453/
JS:
$(document).ready(function () {
var FormAllClass = '.form-all';
var IsValid = function () {
$(FormAllClass).validate();
$('#desc').rules("add", {
required: true,
messages: {
required: "Description is required."
}
});
$(FormAllClass).valid();
};
//IsValid() //Working
$('#job-submit').on('click', function(){
if (IsValid())//not working
{
}
})
});
In the code above, I have marked where it is working and where not.
Any suggestion on how to fix this will be greatly appreciated.