jquery循环遍历表进行文本比较
循环遍历表不是问题。
循环遍历表并同时进行比较,为同一行中的另一个 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>
Looping through the table is not a problem.
Looping through the table and do comparison at the same time assigning the other td in same row with different value is a problem. How can this be done ???
- 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试 -
演示 - http://jsfiddle.net/d45ZQ/1/
Try -
Demo - http://jsfiddle.net/d45ZQ/1/