将parsley.js用于表单的某些区域? [英] Use parsley.js for certain areas of a form?

查看:122
本文介绍了将parsley.js用于表单的某些区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将parsley.js(parsleyjs.org)与acc-wizard.js结合使用( http: //sathomas.me/acc-wizard/ )。

I'm using parsley.js (parsleyjs.org) in combination with acc-wizard.js (http://sathomas.me/acc-wizard/).

有没有办法让欧芹只检查某个区域(参见下面的代码,例如 region one ,可能包含5个输入字段)而不是整个表单?

Is there a way to make parsley check only a certain region (see following code, e.g. region one, which could contain 5 input fields) instead of the whole form?

<form>
    <div id="one">fields for parsley.js to validate...</div>
    <div id="two">fields for parsley.js to validate...</div>
    <div id="three">fields for parsley.js to validate...</div>
</form>

谢谢!

推荐答案

您可以通过JavaScript启动Parsley,以便传递自定义选项。然后,您只需使用已排除参数即可删除您不希望验证的表单中的任何部分。

You can initiate Parsley via JavaScript so that you can pass in custom options. Then you can just use the excluded param to remove whichever sections of the form you don't wish to validate.

http://jsfiddle.net/5JA8R/

$('form').parsley({
    excluded: '.two input, .three input'
});

这篇关于将parsley.js用于表单的某些区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆