title: jQuery, passing selectors as option parameters
body: <p>I'm trying to build a simple jquery plugin that can take selectors as parameters. All of the examples I find expect more raw 'properties' (width, color, etc) than actual selectors. Are there any good ways to do this?</p>
  
  <p>I found this article : <a href="https://stackoverflow.com/questions/541362/passing-jquery-selector-to-sub-function-within-a-plugin">Passing jquery selector to sub-function within a plugin</a></p>
  
  <p>But I'm still relatively confused.</p>
  
  <p>The goal is kind of like this ...</p>
  
  <pre><code>        (function ($) {
              $.fn.demonstration = function (options) {
  
                  var defaults = {
                      $selector: null
                  };
                  var options = $.extend(defaults, options);
  
                  return this.each(function () {
                      alert($selector.attr('id'));
                  });
              };
          })(jQuery);
  
          $('body').demonstration({ $selector: $('#canvas') });
  </code></pre>