本文介绍了绑定为每个JQuery手风琴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为每个循环创建一个使用a的手风琴用户界面。到目前为止,我有以下代码...



HTML

  < div id =accordiondata-bind =foreach:fixtures> 
< h3>< a href =#data-bind =text:name>< / a>< / h3>
< div>资讯< / div>
< / div>

JAVASCRIPT

  $(#accordion)。accordion({header:h3,collapsible:true,active:true}); 

有什么线索会出错?

  $(document).ready(function(){
...
$(#accordion)。accordion({header:h3,collapsible:true,active:true });
});


I want to create an accordion UI using a for each loop. I have the following code so far...

HTML

<div id="accordion" data-bind="foreach: fixtures">
   <h3><a href="#" data-bind="text: name"></a></h3>
   <div>Information</div>
</div>

JAVASCRIPT

$("#accordion").accordion({ header: "h3", collapsible: true, active: true});

Any clues as to where this is going wrong?

解决方案

Put inside $(document).ready(function () {...

$(document).ready(function () {
    ...
    $("#accordion").accordion({ header: "h3", collapsible: true, active: true });
});

这篇关于绑定为每个JQuery手风琴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 02:21