Jquery删除麻烦

时间:2012-11-18 21:16:53

标签: javascript jquery greasemonkey wikipedia

我正在为维基百科制作GreaseMonkey脚本。这是我正在使用的代码:

// ==UserScript==
// @name        wikipedia
// @namespace   wikipedia
// @include     http://es.wikipedia.org/wiki/*
// @version     1
// @grant GM_addStyle
// @require     http://code.jquery.com/jquery.min.js
// ==/UserScript==


$(document).ready(function(){
    $("#mw-panel").remove();
    $("#localNotice").remove();
    $("#mw-head").remove();
    $("#mw-head-base").remove();
    $("#mw-page-base").remove();
    $("#footer").remove();
    $("span[class=\"editsection\"]").remove();
    $("#mw-articlefeedback").remove();
    $("#content").css("margin-top", "0px");
    $("#content").css("margin-left", "0px");
    $("#content").css("padding", "0px");
    $("body").css("font-family", "Droid Sans");
});

这样可以正常工作,但是这行没有达到预期效果,即删除文章反馈对话框。

    $("#mw-articlefeedback").remove();

为什么这不起作用?

1 个答案:

答案 0 :(得分:2)

在页面加载后稍后动态添加。

$(document).ready替换为$(window).load

如果这不起作用,那么只需几秒钟就可以在setTimeout内添加代码。

相关问题