我有我的網頁上的鏈接列表。這裏有一個例子:刪除鏈接,如果鏈接名稱包含字符串
<a href="#">Link (tagMe)</a>
<a href="#">Link (anotherTag)</a>
<a href="#">Link (aThirdTag)</a>
如何獲取jQuery來檢查我的所有鏈接,並刪除了一個字符串「(anotherTag)」,所以輸出列表看起來像:
- 鏈接(塔格梅)
- 鏈路(aThirdTag)
我有我的網頁上的鏈接列表。這裏有一個例子:刪除鏈接,如果鏈接名稱包含字符串
<a href="#">Link (tagMe)</a>
<a href="#">Link (anotherTag)</a>
<a href="#">Link (aThirdTag)</a>
如何獲取jQuery來檢查我的所有鏈接,並刪除了一個字符串「(anotherTag)」,所以輸出列表看起來像:
這就做到了。謝謝! – 2013-04-24 04:26:17
$('a').each(function() {
if($(this).text().match(/\(anotherTag\)/))
$(this).remove();
});
$("a:contains('anotherTag')").remove()
的[如何選擇具有特定文本的所有錨標籤]
可能重複(http://stackoverflow.com/questions/2446936/how-to- select-all-anchor-tags-with-specific-text) – undefined 2013-04-24 04:15:03