【发布时间】:2021-04-06 18:10:47
【问题描述】:
我无法直接编辑我需要更改的文本,因此我需要使用 jQuery 覆盖给定值的文本。
我了解基础知识,但不知道找到值的正确字符串。
所以我知道这适用于 ID。
<script>
$(document).ready(function(){
$('#demo').text('The replaced text.');
});
</script>
所以我的问题是,如何将以下代码的文本(信用卡/借记卡(确认))更改为“确认”值。我无法使用 payment_method 名称,因为它与其他付款方式共享。
<label>
<input type="radio" name="payment_method" value="affirm">
Credit Card/Debit Card (Affirm)
</label>
提前谢谢你!
编辑 1:
整个 HTML 代码
<div id="content" class="col-xs-12 col-sm-12">
<p>Please select your preferred payment method.</p>
<div class="radio">
<label>
<input type="radio" name="payment_method" value="authorizenet" checked="checked">
Credit Card/Debit Card (Authorize.Net) </label>
</div>
<div class="radio">
<label>
<input type="radio" name="payment_method" value="affirm">
Credit Card/Debit Card (Affirm) </label>
</div>
<p><strong>Add comments about your order.</strong></p>
<p>
<textarea name="comment" rows="8" class="form-control"></textarea>
</p>
<div class="cart-module">
<div class="cart-content">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<h4 for="input-coupon">Coupon Code</h4>
<div class="input-group">
<input type="text" name="coupon" value="" placeholder="Coupon Code" id="input-coupon" class="form-control">
<span class="input-group-btn">
<input type="button" value="Apply" data-code="coupon" data-loading-text="Loading..." class="btn btn-primary">
</span>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<h4 for="input-voucher">Gift Certificate Code</h4>
<div class="input-group">
<input type="text" name="voucher" value="" placeholder="Gift Certificate Code" id="input-voucher" class="form-control">
<span class="input-group-btn">
<input type="button" value="Apply" data-code="voucher" data-loading-text="Loading..." class="btn btn-primary">
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="buttons">
<div class="pull-right">I have read and agree to the <a href="https://hhtruckaccessories.com?route=information%2Finformation%2Fagree&information_id=5" class="agree"><b>Shipping and Returns</b></a>. <input type="checkbox" name="agree" value="1">
<input type="button" value="Continue" id="button-payment-method" data-loading-text="Loading..." class="btn btn-primary">
</div>
</div>
<script src="/js/catalog/checkout/payment_method/bundle.js?v=1.58.1" type="text/javascript"></script> </div>
【问题讨论】:
-
解释一下:您想知道如何更改指定单选按钮组中特定单选按钮的文本内容吗?
-
是的,先生。我只想将文本从“信用卡/借记卡(确认)”简化为“确认”