我想更改页面上的两个价格而不是一个。因此,如果 65 英镑或 35 英镑,请更改。
如何向此函数添加“非此即彼”?
$('#shipping-method > table > tbody > tr:nth-child(2) > td.price > label')
.filter(function () {
return $.trim(this.innerHTML) == "£65.00";
}).text('Quote Price');
最佳答案
尝试使用RegExp.prototype.test()
$("#shipping-method > table > tbody > tr:nth-child(2) > td.price > label")
.filter(function () {
return /£65\.00|£35\.00/.test(this.innerHTML);
}).text("Quote Price");
关于javascript - 使用 Jquery 文本替换更改 2 个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35367154/