我有一个html表格,并在表格单元格中按了一个键。现在,我想检查下面的表行中是否有背景颜色为#FFFFCC。我用jQuery-code尝试了一下
var t = $(this).closest('tr').nextAll('[background="#FFFFCC"]').eq(0);
   if (t.length > 0)
   //但它不起作用。
发布于 2012-02-09 22:37:56
您正在尝试使用属性等于选择器,这将不起作用,因为background不是一个属性。我认为你需要做的是:
var t = $(this).closest('tr').nextAll().filter(function(){
            if ($(this).css('background-color') == '#ffffcc'){
                return true;
            }
        });https://stackoverflow.com/questions/9212732
复制相似问题