【发布时间】:2021-10-21 03:14:36
【问题描述】:
我有这个代码:
$('a.comment-reply-link').each(function(){
this.href = this.href.replace("dummy_comment", "author");
this.href = this.href.replace("#comment-", "?replytocom=");
});
这是有效的,但现在我想在 url #respond 的末尾。所以我把代码写成:
$('a.comment-reply-link').each(function(){
this.href = this.href.replace("dummy_comment", "author");
this.href = this.href.replace("#comment-", "?replytocom=");
this.href + '#respond';
});
但这不起作用?我怎样才能让它工作?
【问题讨论】:
-
试试 this.href += '#respond';