如何基于来自其他单元格的数据格式化单元格。条件格式单元格基于另一个单元格号
这是我所做的基于当前单元格式。
\t \t $(document).ready(function() {
\t \t $('table td:nth-child(9)').each(function() {
\t \t \t var req = $(this).text();
\t \t if (req == 1) {
\t \t \t \t $(this).css('backgroundColor', '#009933');
\t \t \t \t \t }
\t \t \t else if(req == 2) {
\t \t \t \t \t \t $(this).css('backgroundColor', '#ffcc00');
\t \t \t \t \t }
\t \t \t \t \t else {
\t \t \t \t \t \t $(this).css('backgroundColor', '#ffffff');
\t \t \t \t \t }
\t \t \t \t });
\t \t \t \t return false;
\t \t \t });
我将如何设置列格式5本从列9的结果?
如果我在中间加.parent()$(本)和.css('的backgroundColor
它会改变整个行。
$(document).ready(function() {
$('table tr').each(function() {
var req = $(this)childNodes[8].text();
if (req == 1) {
$(this).childNodes[4].css('backgroundColor', '#009933');
}
else if(req == 2) {
$(this).childNodes[4].css('backgroundColor', '#ffcc00');
}
else {
$(this).childNodes[4].css('backgroundColor', '#ffffff');
}
});
return false;
});
@Aryaman Tummalapalli
这尝试使用列9中的数字格式化列5