title: Writing JavaScript Functions - Should I Pass jQuery Objects as arguments?
body: <p>I'm curious from both a performance and a "best practices" standpoint. I'm using a lot of jQuery in my JavaScript, and often find myself passing jQuery objects as arguments into functions I'm writing. Is it more efficient/effective to pass the selector string rather than the actual jQuery object as the argument? Is this just a stylistic difference, or are there any good reasons to use one method over the other? </p>
  
  <p>Using jQuery objects in arguments:</p>
  
  <pre><code>function updateSelectOptions(optionsData, $selectElement) {
  
      // function code
  
  }
  </code></pre>
  
  <p>Or using a selector string as the argument:</p>
  
  <pre><code>function updateSelectOptions(optionsData, selectorString) {
  
      var $selectElement = $(selectorString);
      // function code
  
  }
  </code></pre>