I am developing a website which is similar to stackoverflow.com. A poster is required to enter 1 to 3 tags for his problem or task.If a tag has more than one word, then - is used to combine multiple words into single-words, space is used to separate tags. I use Jquery form validation plugin to validate the form. I need to add a customized method to validate the tag input box.
$.validator.addMethod("tagcheck", function(value, element) {
return //To determine the value contains no more than 3 words.
}, "Please input at most 3 tags.");
How to write the customized method?