如何使用 jQuery 定位双引号内的破折号 html 元素?

How to target this dash html element inside the double quotes using jQuery?

我很难定位这个破折号,因为我想把它改成 |。 请查看此屏幕截图:


如何定位该行并将其替换为 |?

这是我正在使用的代码,但它不起作用。请帮忙。

$( ".fusion-price-rating .price:contains('–') .woocommerce-Price-amount::after" ).text('|');

试试这个:

var el = $(".fusion-price-rating .price:contains('–')");
el.html(el.html().replace('-', '|'));

试试这个功能:

$(".woocommerce-Price-amount").text(function () {
    return $(this).text().replace("-", "|"); 
});