在页面加载检查的JavaScript如果一个跨度(下&LT; TR&GT;)与特定的类存在,如果不存在删除整个&LT; TR&GT; [英] javascript on page load check if a span (under <tr>) with a specific class exist, if does not exist remove the entire <tr>
问题描述
我想创建自己的Greasemonkey脚本,我最喜欢的目录列表网站)
问题是不是一切就名单对我有利,我检查了网站code和,因为它似乎,每个条目正在
现在,当它看来,我只有那些具有这种格式感兴趣的是:
&LT; TR类=项目描述&GT;
&LT; TD合并单元格=6&GT;
&LT; DIV CLASS =项目说明-内&GT;
&LT; DIV CLASS =项目简介&GT;
&LT; p =类trunk8&gt;这是一个条目和LT; / P&GT;
&LT; / DIV&GT;
&LT; DIV CLASS =项目验证&GT;
&LT;跨度类=verfied徽章&GT; &LT; ~~~~~~~~~~本SPAN
&LT;跨度类=货币符号&GT; $&LT; / SPAN&GT;
&LT;跨度类=图标,勾选&GT;&LT; / SPAN&GT;
验证
&LT; / SPAN&GT;
&LT; / DIV&GT;
&LT; DIV CLASS =项目行动&GT;
&所述; A HREF =#&GT;
&LT;按钮类=BTN&GT; LOL&LT; /按钮&GT;
&所述; / A&GT;
&LT; / DIV&GT;
&LT; / DIV&GT;
&LT; / TD&GT;
&LT; / TR&GT;
正如你所看到的,存在&LT;跨度类=verfied徽章方式&gt;
触发它
我也希望在页面加载后的JavaScript程序这一点,因为该网站填充通过javascript表了。
我知道我没有在我的问题还没有完成,但如果有人可以只提供一个例子,可以带领我,那就够了。
非常感谢你!
$(文件)。就绪(函数(){
$(tr.project的细节)。每个(函数(){
VAR自我= $(本);
如果(self.find(span.verfied徽章)。长度== 0)
self.remove();
});});
I am trying to create my own greasemonkey script for my favorite directory listing site :)
The thing is not everything it list is beneficial to me, I inspected the website code and as it seems, each entry is under
Now, and as it seems, I am only interested with those which have this format:
<tr class="project-description">
<td colspan="6">
<div class="project-desc-inner">
<div class="project-synopsis">
<p class="trunk8">This is an entry</p>
</div>
<div class="project-verification">
<span class="verfied-badge"> <~~~~~~~~~~ THIS SPAN
<span class="currency-symbol">$</span>
<span class="icon-tick"></span>
Verified
</span>
</div>
<div class="project-actions">
<a href="#">
<button class="btn">LOL</button>
</a>
</div>
</div>
</td>
</tr>
As you can see, the existence of <span class="verfied-badge">
triggers it.
I also wish that the javascript process this after the page loads, because the site populates the table via javascript too.
I know I haven't done in my problem yet, but if somebody can just provide an example that can lead me, that is enough.
Thank you very much!
$(document).ready(function(){
$("tr.project-details").each(function(){
var self = $(this);
if(self.find("span.verfied-badge").length==0)
self.remove();
});
});
这篇关于在页面加载检查的JavaScript如果一个跨度(下&LT; TR&GT;)与特定的类存在,如果不存在删除整个&LT; TR&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!