Binding For-Each to JQuery Accordion

こ雲淡風輕ζ 提交于 2019-12-12 05:11:46

问题


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?


回答1:


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

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


来源:https://stackoverflow.com/questions/12182256/binding-for-each-to-jquery-accordion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!