在不使用表单验证的情况下将验证规则添加到类中? [英] Add validation rule to a class without using the form validation?
问题描述
我想使用jQuery验证类X的元素 我在网上看到的只是验证表格,我不想使用它 还有其他解决方案吗? 谢谢
I want to validate elements with class X using jQuery I looked on net I found just the validation form and I don't want to use it is there another solution? thanks
推荐答案
Use this plugin to validate a form but it only validates input
s where you add the required classes, for example :
<input value="someone@nowhere.com" class="validate[required,custom[email]]" type="text" name="email" id="email" />
<input value="2010-12-01" class="validate[required,custom[date]]" type="text" name="date" id="date" />
<input value="too many spaces obviously" class="validate[required,custom[onlyLetterNumber]]" type="text" name="special" id="special" />
第一个input
将要求(类别= validate[required,custom[email]]
)输入有效的电子邮件.第二个是有效日期(class = validate[required,custom[date]]
),而第三个只有字母或数字(class = validate[required,custom[onlyLetterNumber]]
)
the first input
would require (class = validate[required,custom[email]]
) a valid email to be entered. The second a valid date (class= validate[required,custom[date]]
) and the third only letters or numbers (class = validate[required,custom[onlyLetterNumber]]
)
这篇关于在不使用表单验证的情况下将验证规则添加到类中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!