日期:2014-05-16 浏览次数:20403 次
<form method="post" action="index.php?ac=search&at=list" name="search" id="search">
<input type="text" name="keyword" title="Search" class="searchinput" id="keyword" size="10"/> <input type="image" class="searchaction" />
</form>
$().ready(function() {
$("#search").validate({
rules: {
keyword: {
required: true,
minlength: 2
}
},
messages: {
keyword: {
required: "请输入关键字",
minlength: "不能少于两个字符"
}
}
});
});
$().ready(function() {
$("#search").validate({
onfocusout: false,
onkeyup: false,
onclick: false,
rules: {
keyword: {
required: true,
minlength: 2
}
},
messages: {
keyword: {
required: "请输入关键字",
minlength: "不能少于两个字符"
}
},
showErrors: function(errorMap, errorList) {
this.defaultShowErrors();
for(var i = 0; i < errorList.length; i++) {
$(errorList[i].element).one("blur", function() {
$("label.error[for='" + (this.id ? this.id : this.name) + "']").remove();
});
}
}
});
});