jQuery validation plugin , add custom method
- by Eatdoku
Hi,
I am trying to add a method that validate a field to see if it contains a number value.
so this is what i did, however it is not doing the check for me.
anyone has any idea?
thanks
$(document).ready(function() {
$.validator.addMethod('positiveNumber',
function(value) {
return Number(value) > 0;
}, 'Enter a positive number.');
});
and
jQuery('form').validate();
jQuery('.validateFieldToCheck').rules('add', {
positiveNumber:,
messages: {
required: 'Field must contain a number.'
}
});