给动态生成的html元素添加验证事件(基于jquery的验证组件)
找到需要绑定的元素,用add添加验证事件
elementId = "#xxxxxxxxx_" + rowID; if ($(elementId).rules().required == undefined) { if (!$(elementId).hasClass("ui-disabled")) { $(elementId).rules("add", { required: true, maxlength: 2000, messages: { required: "Please enter a description", maxlength: "Description cannot be longer than 2000 characters" } }); }