It is tag input box validation.A poster can 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. This is the code:
$.validator.addMethod("tagcheck", function(value, element) {
return value && value.split(" ").length < 4;
}, "Please input at most 3 tags.");
But what if there are two spaces between two adjacent words?