asd*_*sdf 2 html javascript jquery text replace
有一些需要更换的文本,在本网站上搜索所有具有相似标题但没有运气的结果.
目前文本是手续费:我需要说运输保险: - 请帮助!
这是页面的html输出;
<div class="c3 right">
<h2>Order Summary</h2>
<table class="styledtable">
<thead>
<tr>
<th>Quantity</th>
<th>Product</th>
<th>Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">1</td>
<td><strong>ACT Clutch Kit - Heavy Duty (HD) (DC1-HDSS)</strong>
<div class="order_item_notes">HD Clutch Kit<br/> Performance Street Disc (SS)</div>
<div class="order_item_specs">
Components : D018, 3001532, ATCP23<br/>
</div>
</td>
<td style="text-align:right">$314.25</td>
<td style="text-align:right">$314.25</td>
</tr>
<tr>
<td colspan="3" style="text-align:right">Items Total</td>
<td style="text-align:right">$<span id="itemstotal">314.25</span></td>
</tr>
<tr>
<td colspan="3" style="text-align:right">Shipping:</td>
<td style="text-align:right">$<span id="shippingtotal">TBD</span></td>
</tr>
<tr>
<td colspan="3" style="text-align:right">Handling Fee:</td>
<td style="text-align:right">$<span id="handlingfee">0.00</span></td>
</tr>
<tr>
<td colspan="3" style="text-align:right">Tax:</td>
<td style="text-align:right">$<span id="taxtotal">0.00</span></td>
</tr>
<tr>
<td colspan="3" style="text-align:right">Order Total:</td>
<td style="text-align:right">$<span id="total">0.00</span></td>
</tr>
</tbody>
</table>
<p>Upon checkout, you <strong>must enter</strong> your cars <strong>year, make and model</strong> into the comments section at the bottom of this page. <strong> We will not complete your order if we do not have this information!</strong></p>
<p> </p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
您可以使用jQuery :contains
选择器:
$("td:contains('Handling Fee:')").text("Shipping Insurance:");
Run Code Online (Sandbox Code Playgroud)
你可以在这里看到它:http://jsfiddle.net/cnhYj/
为了在文档准备好后让它工作,你可以这样写:
$(function() {
$("td:contains('Handling Fee:')").text("Shipping Insurance:");
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8768 次 |
最近记录: |