Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.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循环表以进行文本比较_Jquery_Text_Comparison - Fatal编程技术网

jquery循环表以进行文本比较

jquery循环表以进行文本比较,jquery,text,comparison,Jquery,Text,Comparison,在表格中循环不是问题 在表中循环并同时进行比较会给同一行中的其他td分配不同的值,这是一个问题。如何做到这一点 - going through #tblView tbody tr.class - to find through all row for second td and see whether the .text() is "completed" - if yes - then third

在表格中循环不是问题

在表中循环并同时进行比较会给同一行中的其他td分配不同的值,这是一个问题。如何做到这一点

- going through #tblView tbody tr.class

        - to find through all row for second td and see whether the .text() is "completed"
                - if yes
                        - then third td's span's inner text set to "bingo"
                - else
                        - do nothing
                - end


<table id="tblView">

<tbody>

<tr class="class">

<td>completed</td>
<td></td>
<td></td>

</tr>

<tr class="class">

<td>not yet</td>
<td></td>
<td></td>

</tr>

</tbody>

</table>
-正在通过#tblView tbody tr.class
-查找第二个td的所有行并查看.text()是否已“完成”
-如果有的话
-然后第三个td的span的内部文本设置为“宾果”
-否则
-无所事事
-结束
完整的
还没有
试试看-

$("#tblView tbody tr.class").each(function() {
    if ($(this).find("td:eq(1)").text() === "completed") $(this).find("td:eq(2)").text('bingo'); 
}) 

演示-

你能发布你的html结构吗?