String.prototype.trim = function () {
return this.replace(/^/s*/, "").replace(//s*$/, "");
};
$.validator.addMethod("checkKeyword", function(value, element) {
var k = element.value.split("/n");
for (i=0;i<k.length;i++) {
if (k[i].trim().length > 150 || k[i].trim().length == 0 || k[i].match("/"") || k[i].match("/'"))
return false;
}
return true;
}, "Please select an option.");
$(document).ready(function(){
$("#addLinkFrm").validate( {
rules : {
linkCode : {
required: true,
maxlength:50
},
keywordList : {
checkKeyword:true,
required: true
}
},
messages : {
linkCode : "Please ensure: <br/>1 the length of each ID is no logger than 50 characters.<br/>2 no Single Quote mark, Double Quote mark or Comma for ID.",
keywordList:"Please ensure: <br/>1 the length of each Keyword is no logger than 150 characters.<br/>2 no Single Quote mark, Double Quote mark or Comma for Keyword."
},
errorClass : "error",
errorElement : "p"
});
});