Thursday 15 April 2010

How to add a customized method to determine the number of words in an input box with Jquery form validation plugin? -


I am developing a website that is similar to stackoverflow.com. A poster is required to enter 1 to 3 tags for your problem or work. If there are more than one word in a tag, - Multiple words are used to combine in one-word, the location is used to isolate the tag. Jquery form validation for validating the form I use the plugin. I need to add an optimized method to validate the tag input box.

$ .validator.addMethod ("tagcheck", function (value, element) {return more than 3 words to set the value.}, "Input on maximum 3 tags. ");

How do I write a customized method?

  $ Validator.addMethod ("Tagcheck", Function (Value, Element) {Return Value & amp;; value.split (""). Length & lt; 4;}, "input to maximum 3 tags.");  

No comments:

Post a Comment