我使用WordPress,所以我只能通過自定義JS更改HTML。更改錨文本,同時保持FontAwesome圖標內嵌
這是HTML
<li class="submit-listing"><a href="http://localhost/proficientlink/post-your-ad/"><i class="fa fa-plus"></i> Submit Listing</a></li>
我已經嘗試過所有這些:
$(".submit-listing a").html("<i class="fa fa-plus"></i> Post You Ad");
$(".submit-listing a").html(function(){
$(this).find("i").addClass("fa fa-plus");
this.nodeValue = "Post Your Ad";
});
但這些工作。我也試過這個:How can I get, manipulate and replace a text node using jQuery?,但似乎沒有任何與我一起工作。
無論如何。
歡迎堆棧溢出。我很高興你能解決你的問題。請參閱[當某人回答我的問題時該怎麼辦?](https://stackoverflow.com/help/someone-answers)並考慮接受下面的答案之一,以便該問題在網站上被標記爲已解決。 – FluffyKitten