使用greasemonkey从源代码中删除URL

时间:2016-02-01 11:43:12

标签: html greasemonkey

我想要做的是从此

中删除网址
<h1 itemprop="name" id="book"><a href="http://www.example.com/book/=/book_num/xxxxxxxxx.html" 
itemprop="url">name of book</a></h1>

将提供此

<h1 itemprop="name" id="name2">name of book</h1>

请注意,url中的xxxxxxxxx在每个链接中都有所不同

2 个答案:

答案 0 :(得分:0)

/*--- Use the jQuery contains selector to find content to remove.
    Beware that not all whitespace is as it appears.
*/
var badDivs = $("div div:contains('Annoying text, CASE SENSITIVE')");

badDivs.remove ();

答案 1 :(得分:0)

经过一些研究得到它

$("#book a").removeAttr("href");