English 中文(简体)
jquery to loop through table for text compar
原标题:jquery to loop through table for text comparison

排在桌面上不是一个问题。

问题在于通过表格进行对比,同时将另一条拖到具有不同价值的同一行中。 如何做到这一点?

- 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>
最佳回答

Try -

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

Demo -

问题回答

暂无回答




相关问题
Find the closest time from a list of times

So, here s the scenario. I have a file with a created time, and I want to choose a time from a list of times that that file s created time is closest or equal too...what would be the best way to ...

PHP Comparison Operators and Data Types

I m currently working through O Reilly s "Programming PHP" and have come across this table titled "Type of comparison performed by the comparison operators": First Operand | Second ...

Loop Until Condition Reached, iPhone

I have a problem here... After a button is pressed I want a loop to run until a condition is reached: - (IBAction)buttonclick1 ... if ((value2ForIf - valueForIf) >= 3) { ... I would like a loop ...

nuSoap or Zend Soap? [closed]

I would like to know the differences between nusoap and ZendSoap, which is the best? what benefits and disadvantages of each? Anyone who has used both technologies could make this comparison? Thank ...

Logic for a file compare

I trying to write a programm for file compare. For example: file1 1 2 3 4 5 file2 1 2 @ 3 4 5 If I do it line by line, I get: 1 == 1; 2 == 2; 3 != @; 4 != 3; 5 != 4; != 5; But, the truth is ...

热门标签