javascript - 如何使用 jQuery 将双引号内的破折号 html 元素作为目标?

标签 javascript jquery html dom quotes

我很难定位这个破折号,因为我想将它更改为|。 请检查此屏幕截图:
enter image description here

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

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

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

最佳答案

试试这个功能:

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

关于javascript - 如何使用 jQuery 将双引号内的破折号 html 元素作为目标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44040699/

相关文章:

jquery - 这里如何选择h4标签?

jquery - 如何根据在 jquery 文本框中扫描的值在行列表中交换特定行

javascript - float div的垂直对齐

html - PDF页面溢出

javascript - React - 阻止表单提交

javascript - "withRouter"和 redux 的 "connect()"的问题

javascript - 使用 jQuery 从 json 动态呈现无序列表

javascript - <video> 使用 MediaRecorder() 从 <canvas> 播放录制的流,使用 canvas.captureStream() 在 firefox、chromium 上呈现不同的效果

javascript - 如何使效果从上到下1页像android标题栏一样使用css3

html - 粘性导航菜单没有正确粘在顶部