Chrome扩展程序内容脚本中的JQueryUI

4
在将jquery-ui(css和js)和jquery放入清单(manifest)后,我可以使用jq选择器($),但是jquery-ui似乎无法访问。例如,我正在尝试在内容脚本(content_script.js)中插入一个可调整大小的div:
var $div = document.createElement('div');
$div.id = 'divId';
$div.innerHTML = 'inner html';
$("body").append($div);//works without error
$("#divId").css("background-color","yellow");//works
//doesn't give resizable handles, however works in a regular html file:
$("#divId").resizable();
//however this also has issue:
document.getElementById("divId").style.resize = "both";

清单文件:

"css":["jquery-ui.css"],
"js": ["jquery-ui.js","jquery.js","content_script.js"]
1个回答

5

加载顺序错误 - jquery-ui 要求先加载 jquery

"js": ["jquery.js", "jquery-ui.js", "content_script.js"]

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接