scope issue inside jquery plugin
<p>How would I get to call the method showAlert() I have tried storing a reference to the plugin with this and $(this) inside the self variable but none seem to work. I'm calling the showAlert from inside the button click event.</p>

<pre><code> (function($){

      //Add your default settings values here
      var settings = {
        //Replace with your own settings
        testValue:"FOO"
      }

      var selectedArr=[];
      var self=this;

      var methods = {
        init : function(options){
          return this.each(function(){
            //if options exists, let's merge them with our default settings
            if(options){
              $.extend(settings,options);
            }

            var $this=$(this);
            var button = $this.find('.schedule .time a');

            button.click(function(evt){
                evt.preventDefault();
                selectedArr.push( $(this).addClass('selected') );
                $(this).parent().find('input').attr('checked','checked');
                self.showAlert();
            })
          });
        }
      }

        showAlert: function(){
            alert("Please select an alternitive");
        }

      //Setting namespace. Under no circumstance should a single plugin ever claim more than one namespace in the jQuery.fn object. 
      //See http://docs.jquery.com/Plugins/Authoring for an explaination of the method used here
      $.fn.chooseAppointment = function(method){

        if(methods[method]){
          return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
        }else if(typeof method === 'object' || !method){
          return methods.init.apply(this,arguments);
        }else{
          $.error('Method ' + method + ' does not exist on jQuery.chooseAppointment');
        }
      };

    })(jQuery);
</code></pre>
