How can I change the background color of a cell in a jqgrid custom formatter?
问题 I can change the text color by doing this in jqgrid custom formatter: function YNFormatter(cellvalue, options, rowObject) { var color = (cellvalue == "Y") ? "green" : "red"; var cellHtml = "<span style='color:" + color + "' originalValue='" + cellvalue + "'>" + cellvalue + "</span>"; return cellHtml; } but I want to now change the background color of the whole cell (instead of the text color). Is this possible? 回答1: If you want use <span> element inside of the custom cell formatter you can