我花了很多时间在这上面,所以我想我会问堆栈溢出社区。我有一个带有html文件的chrome扩展项目:
// Run our kitten generation script as soon as the document's DOM is ready.
document.addEventListener("DOMContentLoaded",
function() {
});
$(function() {
$("#slider-range-min")
.slider({
range: "min",
value: 37,
min: 1,
max: 700,
slide: function(event, ui) {
$("#amount").val("$" + ui.value);
}
});
$("#amount").val("$" + $("#slider-range-min").slider("value"));
});

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Slider - Range with fixed minimum</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="popup.js"></script>
<script src="extras.js" type="text/javascript"></script>
</head>
<body>
<p>
<label for="amount">Maximum price:</label>
<input type="text" id="amount" readonly style="border: 0; color: #f6931f; font-weight: bold;">
</p>
<div id="slider-range-min"></div>
</body>
</html>
&#13;
当我单独运行时,它的工作效果非常好。但是,当我在Chrome中运行附加到我的应用程序的操作按钮时,没有任何功能出现。我很困惑为什么。我没有包含任何内联javascript,这个例子直接来自jquery网站。对此事的任何帮助都会有很大的帮助!