嗨我试图从JS中删除箭头.但似乎替换不起作用:-(
<a class="pr-page-prev">« Previous</a>
<a class="pr-page-next">Next »</a>
$('.pr-page-prev').text().replace(/«/, '')
$('.pr-page-next').text().replace(/»/, '')
Run Code Online (Sandbox Code Playgroud)
您正在替换文本而不是元素的内容.
当你说$('.pr-page-prev').text(),它返回你正在调用replace的文本内容,它将返回被替换的文本,但它不会被设置回元素.因此,即使您已经替换了文本,它也不会应用于元素.
$('.pr-page-prev').text(function(i, text){return text.replace(/«/, '')})
$('.pr-page-next').text(function(i, text){return text.replace(/»/, '')})
Run Code Online (Sandbox Code Playgroud)
演示:小提琴
| 归档时间: |
|
| 查看次数: |
266 次 |
| 最近记录: |