我在用jQuery手风琴。在我的jsp中,我有以下结构:
<div id="accordion">
<c:if...>
<h3>Heading 1</h3>
<div>
<table>
Content 1
</table>
</div>
</c:if...>
<c:if>
<h3>Heading 2</h3>
<div>
<table>Content 2
</table>
</div>
</c:if>
</div>下面是我按照给定的顺序包含的jquery。
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>我试图在页面加载上打开第一个元素(即“标题1”和“内容1")。当用户单击第二个“标题2”时,第一个标题应自动关闭。
我尝试使用以下代码在document.ready上加载手风琴
$(document).ready(function() {
$( "#accordion" ).accordion({ active: 0 });
});但我仍然会发现错误:
对象不支持属性或方法。
发布于 2015-05-18 13:00:44
你的密码在我看来没问题。我用它建立了一个小提琴,它可以工作。
我要看的是
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>在我的小提琴中,我包含了jQuery UI 1.9.2 (尝试使用该版本的jQuery UI,或者尝试jQuery和jQuery UI的更新版本,我注意到jsfiddle在jQuery 1.10.1上不支持jQuery UI,但在2.0.2上确实支持UI 1.10.3)。
https://stackoverflow.com/questions/30303811
复制相似问题