I'm using a Drupal 7.x View to display field data corresponding to a custom content type. Nothing really special here as far as Drupal or PHP is concerned but when I try to use Drupal behaviors to make one of the divs "expandable," I run into problems: the jQuery I'm using works after first-time page request--everything is toggled correctly--but as soon as I activate an AJAX call using the Drupal Views filter input, the jQuery associated with the toggle button "gets lost."

Here's the code I'm using which I load through Drupal's "template.php" file:
Code:
(function ($) {
    Drupal.behaviors.mymodule = {
        attach: function(context, settings){

            $(function(){

                //The toggle.
                $('.toggle').click(function(){
                    if($(this).attr('title') == 'Show More'){
                        console.log('a');                        
                        $(this).attr('title','Show Less');
                        $(this).addClass('open');
                        $(this).removeClass('close');
                        $(this).parent('.field-content').removeClass('more');
                        $(this).parent('.field-content').addClass('less');
                    }else{
                        console.log('b');
                        $(this).attr('title','Show More');
                        $(this).addClass('close');
                        $(this).removeClass('open');
                        $(this).parent('.field-content').removeClass('less');
                        $(this).parent('.field-content').addClass('more');
                    }
                });

            });
        }
    }
})(jQuery);
Long story short, any hyperlink that has the class of "toggle" gets this logic assigned to it. So when John Doe clicks on one of these, the DIV expands to show the other information. Everything works during a fresh page request, but as soon as someone uses the Views filter input (the thing that makes the AJAX call), this functionality stops working correctly.

One thing I did notice in Firebug is this: when the page is loaded for the first time, it takes two clicks of the link to make 'a' and 'b' show up in the console. However, after the AJAX request, it only takes 1 click for both 'a' and 'b' to appear... (As if both conditions get fired off with only 1 click...)

Thoughts?