【发布时间】:2021-07-12 13:03:21
【问题描述】:
目标:我正在尝试在Frontend Mentor 上添加一个输入元素来排序/搜索解决方案。
问题:输入元素出现在页面上,但一秒后消失。
代码:
// ==UserScript==
// @name FEM
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author bunee
// @match https://www.frontendmentor.io/solutions
// @icon https://www.google.com/s2/favicons?domain=frontendmentor.io
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.addEventListener("load", () => {
const inputElement = document.createElement("INPUT");
inputElement.setAttribute("type", "text");
const navBar = document.querySelector(".NavigationSecondary__Wrapper-sc-13y3yjk-0>.wide-container");
navBar.append(inputElement);
console.log(inputElement);
}, false);
})();
如果可以的话,请运行这个脚本,让我知道我错了。
【问题讨论】:
标签: greasemonkey tampermonkey userscripts