2014-12-27 2 views
-1

의 하이퍼 링크를 제거하면 블로거 게시물에서 하이퍼 링크를 비활성화하거나 평면 앵커 텍스트로 대체 할 수있는 방법이 있습니다. 내가 코멘트에서 하이퍼 링크를 변경하는 코드를 찾았지만 게시를 위해 변경하려고 시도하는 결과가 없습니다.블로거 게시물 본문

<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'/> 
<script>$('.comment-content a[rel$=nofollow]').replaceWith(function(){return ($(this).text());});</script>   

고맙습니다.

답변

1

게시물의 하이퍼 링크를 선택하려는 경우 .post-body을 시도해 볼 수 있습니다.이 섹션의 설명 섹션은 .comment-content입니다. 당신은 앵커 요소를 유지하고 단지 href 속성이 시도 제거 할 경우는 일반 텍스트와 하이퍼 링크를 대체

$('.post-body a').replaceWith(function(){ 
    return $(this).text(); 
}); 

이런 식으로 뭔가,

$('.post-body a[href]').each(function(){ 
    $(this).removeAttr('href'); 
}); 
관련 문제