簡體   English   中英

使用索引td連續查找附加的td的背景色

[英]Find background-color of the appended td in a row using index of td

我需要在當前使用Jquery附加的行中找到附加的td的背景色,但是它不起作用。

如何使用索引值獲取td的css。

到目前為止,這是我嘗試過的:

while ($(row1).children('td:nth-child(' + startIndex + ')').css('background-color') == 'rgba(0,0,0,0)') {
    startIndex = startIndex + 1;
}
//Here row1 - is tr , startIndex - Index of td which I need to find css

試試這個可能有幫助並滿足您的要求!

$(document).ready(function () {
    $("#table-id tr").each(function () {
        if($(this).children('td:nth-child(' + startIndex + ')').css('background-color') == "rgb(0, 0, 0)"){
          startIndex = startIndex + 1;
        }
    });
})

注意:某些瀏覽器支持rgba(0,0,0,0)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM