jquery validate plugin + addmethod('math') for a numeric verification
Hi everyone,
i hardly try to use a method i added
here is the code:
- //addMethod( name, method, [message] )
- jQuery.validator.addMethod(
- "math",
- function(value, element, params) { return this.optional(element) || value == params[0] + params[1]; },
- jQuery.format("Please enter the correct value for {0} + {1}")
- );
i added this code between $(document).ready(function(){ and $("#commentform").validate();
in my form i have:
- <label for="captcha">Verification: X + Y = ?</label><input type="captcha" name="captcha" id="captcha" class="required" /><br />
i try to use the new method math in order to display an addition in the label and the result have to be typed in the input, but i fail, please, can someone help me ?
(sorry for my english)