我试图使用jquery在rails中向我的应用程序添加一个简单的进度条。我遵循这个例子:http://jqueryui.com/progressbar/
我创建了div
<div id="progressbar"></div>
在我的JS中
$(document).ready( function() {
$("#progressbar").progressbar({
value: 37
});
});
但是html中的div没有发生任何变化-它仍然是空的,没有样式(即没有对它应用额外的CSS )。
我已经检查了我的应用程序中包含了jquery,特别是,我已经确定了jquery文件是包括在内的。
然而,我愿意打赌这个问题与jquery在我的应用程序中不能正常工作有关,因为我对它和工具提示函数有另一个问题,这是我在这里问到的:positioning jQuery tooltip。
这让我发疯了,有人有什么想法吗?
发布于 2014-10-10 04:49:32
我现在也有同样的问题。
该示例中引用的libaries似乎不起作用。
我从"Firefox - Developer Tools - Browser Console“中得到的错误是:
ReferenceError:$未定义
(我在Firefox 32.0.3和IE 11上进行了测试)
如果您只是将示例html/jquery源从"http://jqueryui.com/progressbar/“复制到本地文件(让我们调用它:"testJqueryProgressBar.html")并双击它,您将不会看到任何进度条!
“testJqueryProgressBar.html”的来源:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Progressbar - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
<link rel="stylesheet" href="//jqueryui.com/resources/demos/style.css">
<script>
$(function()
{
$( "#progressbar" ).progressbar({ value: 37 });
});
</script>
</head>
<body>
<div id="progressbar"></div>
</body>
</html>
因此,我检查了示例标题中的链接,并且都引用了一些内容。所以链接是有效的!
我甚至试图引用来自另一个提供者f.e的jquery库。:https://developers.google.com/speed/libraries/devguide?hl=de#jquery-ui。同样的问题!
然后我转到http://jqueryui.com/download/ Selected : 1.11.1 (稳定的,用于jQuery1.6+)在底部选择了一个不同的UI主题
在我的本地示例testJqueryProgressBar.html中下载了zip并引用了这些解压缩的jquery源代码,并且它成功了。
https://stackoverflow.com/questions/15348046
复制相似问题