views:

32

answers:

1

I have a standard jquery ui accordion and I load content into it using a link_to_remote tag (in the accordion header). All this works fine. The problem is, once the content is loaded, I dont want a ajax call, I just want the accordion to fold, like it should normally do. I tried doing this using the following jquery but clicking the header hence the link still makes a request.

#lbs_list is the div inside the accordion.

$j('#lnk_show_benefit').bind('click', function(e) {
    if ($j('#lbs_list').is(':visible')) {
      e.preventDefault();
      return false;
    } else {
      return true;
    }
});
A: 

Well I used the :before optiopn of link to remote to do this..

:before => "if ($('lbs_list').childElements().size() > 1) {return false}

Not sure if its the best solution though.

badnaam