version question

version question

Gretengs to everyone. I'm a jquery begginer and have a question about version of jquery.

The following code works in version 1.7.2 but doesn't work on 1.9.1. I've checked the documentation and the changes between versions and nothing says anything about fade() like functions or toggle(). Also, I've tried other selectors inside toggle function but none of them works. Here's the code...

Thanks to anyone who answers.

  1. $(document).ready(function() {
     $('.answer').hide();
     $('.main h2').toggle(
            function() {
               $(this).next('.answer').fadeIn();
               return false;
            },
            function() {
               $(this).next('.answer').fadeOut();
               return false;
          }
      );
    });