尝试使用此page的折扣价替换您的价格,我做错了什么?
<script type="text/javascript">
$(document).ready (
function() {
$("td:contains('Your Price:')").text("Discount Price:");
}
);
</script>
谢谢!
答案 0 :(得分:1)
为什么当你上课时,你会用contains来查找它吗?
<div id="ctl00_MainContentPlaceHolder_YourPriceDiv" class="yourprice">
Your Price: <span id="ctl00_MainContentPlaceHolder_YourPriceLabel">$959.20</span>
<span class="thcustom"><br />Free Shipping</span>
</div>
选择器应该只是该类名。
var elem = jQuery(".yourprice");
elem.html( elem.html().replace("Your Price:","Discount Price:") );
答案 1 :(得分:0)
为什么不把“你的价格:”放在:
<span id="lblPrice"> then $("#lblPrice").text("Discount Price:")
答案 2 :(得分:0)
var pricetag = $('.yourprice').html().replace('Your','Discount');
$('.yourprice').html(pricetag);
这应该适用于该网站,只需将其包含在文档中
或
$('.yourprice').html(($('.yourprice').html().replace('Your','Discount')));