Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我有一个 jquery 手风琴硬编码并且工作完美,但我想动态地将另一个窗格添加到同一个手风琴的末尾,但我似乎无法得到它。
这是我用来尝试附加到手风琴 div 末尾的代码:
$('#accordion').append($('<h3><a href="#"></a>Test</h3><div><table><tr>Hello</tr></table></div>'));
不幸的是,看起来没有内置的方法可以做到这一点。但这有效:
$( "#accordion" ).accordion(); $('#add').click(function(){ $('#accordion').append('<h3><a href="#">Section 5</a></h3><div><p>5</p></div>'); $( "#accordion" ).accordion('destroy').accordion(); });
http://jsfiddle.net/Vr55M/