Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery:遍历一个表以查找某个值的出现情况并更改行';s css_Jquery_Html_Css - Fatal编程技术网

Jquery:遍历一个表以查找某个值的出现情况并更改行';s css

Jquery:遍历一个表以查找某个值的出现情况并更改行';s css,jquery,html,css,Jquery,Html,Css,我的表格结构如下: <table id="table1"> <thead> <tr> <th>Task</th> <th>Status</th> </tr> </thead>

我的表格结构如下:

 <table id="table1">

            <thead>
                <tr>
                    <th>Task</th>
                    <th>Status</th>
                </tr>
            </thead>

            <tbody>
                <tr>
                    <td>task 1</td>
                    <td>SUC</td>
                </tr>
                 <tr>
                    <td>task 2</td>
                    <td>SUC</td>
                </tr>
                <tr>
                    <td>task 3</td>
                    <td>ERR</td>
                </tr>
                <tr>
                    <td>task 4</td>
                    <td>ERR</td>
                </tr>
它只是改变了columun状态的特定单元格的css

我想更改整行的css,状态为ERR。 我试过类似的方法

$(this).parent().css('background-color', '#59f763');

试试这个:使用
closest('tr')


试试这个:使用
closest('tr')


试试这个:使用
closest('tr')


试试这个:使用
closest('tr')

在jquery中使用

$("#table1 td:contains('ERR')").parent().css('background-color', '#59f763');

在jquery中使用

$("#table1 td:contains('ERR')").parent().css('background-color', '#59f763');

在jquery中使用

$("#table1 td:contains('ERR')").parent().css('background-color', '#59f763');

在jquery中使用

$("#table1 td:contains('ERR')").parent().css('background-color', '#59f763');

尝试更改此选项:

$(this).parent().css('background-color', '#59f763');
为此:

$(this).closest('tr').find('td').css('background-color', '#59f763');
尝试更改此选项:

$(this).parent().css('background-color', '#59f763');
为此:

$(this).closest('tr').find('td').css('background-color', '#59f763');
尝试更改此选项:

$(this).parent().css('background-color', '#59f763');
为此:

$(this).closest('tr').find('td').css('background-color', '#59f763');
尝试更改此选项:

$(this).parent().css('background-color', '#59f763');
为此:

$(this).closest('tr').find('td').css('background-color', '#59f763');
您可以使用以html“ERR”过滤td,然后使用parent()获取其父tr并对其应用css

您可以使用以html“ERR”过滤td,然后使用parent()获取其父tr并对其应用css

您可以使用以html“ERR”过滤td,然后使用parent()获取其父tr并对其应用css

您可以使用以html“ERR”过滤td,然后使用parent()获取其父tr并对其应用css

.parent()为我工作,请看小提琴:.parent()为我工作,请看小提琴:.parent()为我工作,请看小提琴:.parent()为我工作,请看小提琴: