I need to be able to validate fractions on my form using jquery.validate and jquery.validate.unobtrusive. I have changed my html markup to include 'fraction'
<input class="span12 data fraction" data-val="true" name="FrontHoodHeightL" id="FrontHoodHeightL" type="text" value="29 15/16">
in the class name and I have included the following javascript in my page.
$.validator.addMethod("fraction", function (value, element, param) {
var fracExp = new RegExp("(?:-(?!0))?\d+(?:(?: \d+)?/\d+)?");
return fracExp.test(value);
});
but the method never seems to get called. What step am I missing to wire this up?