设置只读
// 设置只读 function SetReadOnly(jObj) { if (jObj.children().length > 0) { jObj.find("input,textarea").each(function () { var that = $(this); that.prop("readonly", true) .css("background-color", "#EBEBE4"); if (that.hasClass("datepicker")) { that.datepicker("destroy") } }) jObj.find("select").each(function () { $(this).bind("focus", function (e) { this.defaultIndex = this.selectedIndex; }) .bind("change", function (e) { this.selectedIndex = this.defaultIndex; e.preventDefault(); }) .css("background-color", "#EBEBE4") .attr("readonly", "readonly"); }); } else { jObj.prop("readonly", true) .css("background-color", "#EBEBE4"); } }