javascript - 使用 jQuery 按 id 隐藏 div 在 Greasemonkey 中不起作用?

标签 javascript jquery greasemonkey

this Newyorker webpage , 顶部边框(显示“纽约客”)占用了大量空间。
我在“开发者火狐版”打开网页,使用网页检查器发现边框的div id是mobile-nav-container

那么,为什么下面的代码不起作用? :

// ==UserScript==
// @name        newyorker
// @namespace   N
// @include     http://www.newyorker.com/*
// @version     1
// @grant       none
// ==/UserScript==
console.log('Grease monkey start');
$('#mobile-nav-container').hide();
console.log('Grease monkey end');

最佳答案

他们似乎在将 $ 函数用于其他用途。尝试:

jQuery('#mobile-nav-container').hide();

关于javascript - 使用 jQuery 按 id 隐藏 div 在 Greasemonkey 中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26975167/

相关文章:

jquery - 使用 jquery animate 滚动到页面顶部

javascript - 如何为其他用户远程启用/禁用 tampermonkey 脚本

forms - 从 URL 或数据 URL 上传表单文件?

javascript - mongoDb 查询使用 $in 和 $or? 搜索值

javascript - 在 jQuery 中提交带有 JSON 数据的表单

javascript - 从数组中选取 2 个随机元素

Javascript 变量声明为代码并重用

javascript - 循环 GM_xmlhttpRequest 在变量上给出 "TypeError Null"

javascript - 当用户单击 x 时关闭所有网站页面上的 div

javascript - 将 Angular 应用程序包装在 jQuery 函数中