查找文本并将其删除jquery [英] Find text and remove it jquery
本文介绍了查找文本并将其删除jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
使用jQuery查找文本字符串?
你如何找到一个文本字符串并用jquery隐藏它。
How do you find a text string and hide it with jquery.
<div class="report-box">
<div class="title">test</div>
<table>
<tbody>
<tr align="center" class="CellLabel">
<td colspan="2">Day at a Glance</td>
</tr>
<tr class="CellLabel">
<td>New Clients</td>
<td>00000</td>
</tr>
<tr class="CellLabel">
< td>Money Received</td>
<td>$ 0000,000.0000</td>
</tr>
<tr class="CellLabel">
<td>Overdue Invoices</td>
<td>0000000</td>
</tr>
<tr class="CellLabel">
<td>Services</td>
<td>000000</td>
</tr>
<tr align="right" class="CellLabel">
<td colspan="2"></td>
</tr>
</tbody>
</table>
</div>
如何删除
<tr class="CellLabel">
<td>Money Received</td>
<td>$ 0000,000.0000</td>
</tr>
。
推荐答案
首先,你的html有点乱,缺少一些标签。但是你走吧。 ;)
First off, your html is a bit messy, lacks a few tags. But here you go. ;)
预览 - http://jsfiddle.net/Xpc63/1/
$('.CellLabel').removeByContent('Money');
见完整JS代码的预览。
预览 - http://jsfiddle.net/ahzPs/1/
$('.CellLabel').contains('Money').remove();
查看完整JS代码的预览。
预览 - http://jsfiddle.net/mWtzw/
$('.CellLabel').filter(function() {
return $(this).html().indexOf('Money') != -1;
}).remove();
这篇关于查找文本并将其删除jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文