Hi, I need to control my accordion from "outside", i.e. I need to be able to open a specific part on some event. I have came up with this:
jQuery.fn.accordion = function () { this.find('dd:not(:first)').hide(); return this.each(function() { $(this).children('dt').each(function() { this.accordion_open = function() { // prevent slide on already opened accordion element if(!$(this).next(':visible')[0]) $(this).siblings('dd').slideUp(). end().next().slideDown(); } }); $(this).children('dt').bind('click', function() { this.accordion_open(); }); }); } Now I can do stuff like $('#somedt')[0].accordion_open() and it works as expected. Questions: is this the best way to do this? I understand why I need to call my attached function via $()[0], but it's still annoying... so I am again wondering if there are better ways to accomplish what I am trying to do. Thanks for any input, Matt