0
我想在網站上添加一個「info div」。對於這一點,我通過Tampermonkey腳本中添加一些HTML代碼:Tampermonkey - 使用jQuery和jQuery UI的問題
// ==UserScript==
// @name New script
// @namespace http://tampermonkey.net/
// @version 1.1
// @description try to take over the world!
// @author You
// @match http://www.monsite.com/*
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_listValues
// @grant GM_addStyle
// @grant GM_getResourceText
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js
// @require https://code.jquery.com/ui/1.11.4/jquery-ui.min.js
// ==/UserScript==
/* jshint -W097 */
'use strict';
var html = "<div id='myDiv'>CONTENT</div>";
$('body').append(html);
$(function() {
$("#myDiv").draggable();
});
當我嘗試將其移動,我有一個控制檯錯誤:
Uncaught TypeError: n.style is not a function
有關信息,我得到了同樣的問題,如果我想用 $ .slideToggle() ..
任何想法如何解決這個問題?
感謝
有了這個,我得到了同樣的錯誤 '$ html.draggable();' –
我看到該網站使用jQuery 1.7 ..可以這是問題的根源嗎? –