开发者

knockoutjs with custom jQuery validation rules

How can i add custom jquery validation rules against the fields generated from knockoutjs's template items?

In this modified example of 'Editable grid' (http://jsfiddle.开发者_如何学Cnet/cEy2X/), I have changed the Price field to a Date field. I would like to add custom jQuery validation rules on the date fields. I know jQuery Validation has a built-in 'date' for that, but it's just a dumb javascript date format check.

Thanks for the help.


Replace your the part where it validates the price for a number with the following

<td><input class='required date' data-bind='value: price, uniqueName: true' /></td>

change number to date and it does validates the date for you. if that what you want.

http://jsfiddle.net/cEy2X/15/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜