我想在页面上更改两个价格,而不是一个。因此,如果是35 65或35 35,请更改。
如何在此函数中添加一个或/或?
$('#shipping-method > table > tbody > tr:nth-child(2) > td.price > label')
.filter(function () {
return $.trim(this.innerHTML) == "£65.00";
}).text('Quote Price');发布于 2016-02-13 00:24:33
尝试使用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");发布于 2016-02-13 00:27:19
可以使用简单运算符或||运算符
$('#shipping-method > table > tbody > tr:nth-child(2) > td.price > label')
.filter(function () {
return ($.trim(this.innerHTML) == "£65.00" || $.trim(this.innerHTML) == "£35.00");
}).text('Quote Price');https://stackoverflow.com/questions/35367154
复制相似问题