我正在使用验证插件。我想弄清楚如何清除文本字段,如果该字段无效。如果输入字段无效,则清除输入字段
我的javascript代码如下
$(document).ready(function() {
$("#enrollForm").validate({
rules: {
email: {
required: true,
email: true
},
vemail: {
required: true,
email: true,
equalTo: "#email"
},
offer_code: {
required: false,
remote: "check_code.php"
}
}
});});
我试图清除叫offer_code领域如果该字段是无效的。是否有可能在验证功能中做到这一点?
亚历
你在哪里放置它,所以它被称为?有回调句柄吗? – Matt 2010-11-15 19:29:10
@Matt,因为'input'的清除依赖于被分配(确实是通过插件)的css选择器,而不是返回任何特定数据的插件,所以我认为它不重要。虽然我通常会首先调用插件*,然后它会让'.error'类更加有意义。 – 2010-11-15 19:35:27