我有點卡住了。 我是聯合內容,並試圖撤銷我繼承的一些垃圾。在返回的代碼中,有2個URL。第一個需要用第二個替換。例如:使用jQuery替換div中的第一個URL,使用div中的第二個URL
<div class="col-md-3 col-sm-3 col-xs-12 pt-cv-content-item pt-cv-1-col" data-groups="category-266 category-145 category-264 category-263" data-pid="3515">
<div class='pt-cv-ifield'>
<a href="url-to-site-1" class="_self pt-cv-href-thumbnail pt-cv-thumb-default cvplbd" target="_self" >link text</a>
<h4 class="pt-cv-title"><a href="url-to-site-1" class="_self cvplbd" target="_self" >link text</a></h4>
<div class="pt-cv-content">
<p><a href="good-link" target="_blank">good link text</a></p>
</div>
</div>
</div>
在這個例子中,我的目標是取代「URL到站點-1」上使用jQuery飛「好鏈接」。
我可以使用jQuery函數輸出div中的所有鏈接,但我堅持用Url2替換URl1。
下面是登錄網址到控制檯了jQuery:
$('.pt-cv-1-col').find('a').each(function() {
console.log($(this).attr('href'));
});
任何幫助,將不勝感激。我需要第二套眼睛。