2013-09-05 5 views

ответ

0

Скажем, у вас есть

<input id="integer" type="text" name="integer" /> 

Вы могли бы сделать

function is_integer(value) { return value.test(/^[+-]?[0-9]+$/) } 

// Your "validation scheme", as per happyjs.com... 
... 
'#integer': { 
    required: true, 
    message: 'This must be an integer', 
    test: is_integer // this can be *any* function that returns true or false 
}, 
... 

Пробовали ли вы читаете http://happyjs.com/?

Смежные вопросы