var messages = {};
$.each($("input[required=true]"), function (i, item) {
var v = $(item).parent().prev("p").children("span").text().replace(":*", "");
v = v.split("~");
v = v[0];
if (v == '使用地区') {
messages[$(item).attr("id")] = {required: '请选择' + v};
} else {
messages[$(item).attr("id")] = {required: '请输入' + v};
}
})
$.each($("select[required=true]"), function (i, item) {
messages[$(item).attr("id")] = {required: '请选择' + $(item).parent().prev("p").children("span").text().replace(":*", "")};
})
$("#application").validate({messages: messages});