title: Why am I getting "undefined" when I call .options on my select box?
body: <p>I am trying to follow this tutorial (http://railscasts.com/episodes/88-dynamic-select-menus) to get dynamic select boxes working with RoR. No need to worry about the RoR bit, this is a Javascript specific question.</p>
  
  <p>Every time this function runs I get the error that the "options" is undefined. I've tried running the command manually in the console, but regardless, it spits out undefined. I have it typed exactly as I see it in the tutorial, but somehow it's not working for me...</p>
  
  <p>Here's the javascript in question:</p>
  
  <pre><code>function clientSelected() {
  var client_id = $('#piece_client_id').val();
  // THIS IS THE PROBLEM LINE 
  var options = $('piece_campaign_id').options;
  options.length = 0;
  campaigns.each(function(campaign) {
      if (campaign[0] == client_id) {
          options[options.length] = new Option(campaign[1], campaign[2]);
      }
  });
  if (options.length == 1) {
    $('campaign_field').hide();
  } else {
    $('campaign_field').show();
  }
  }
  </code></pre>
  
  <p>Here is the HTML that it's trying to work on:</p>
  
  <pre><code>&lt;select id="piece_campaign_id" name="piece[campaign_id]"&gt;&lt;option value=""&gt;&lt;/option&gt; 
  &lt;option value="1"&gt;Feed The Dogs&lt;/option&gt; 
  &lt;option value="2"&gt;Watch Television&lt;/option&gt; 
  &lt;option value="3"&gt;End The Suffering&lt;/option&gt; 
  &lt;option value="4"&gt;Brian Bilbrey&lt;/option&gt; 
  &lt;option value="5"&gt;SummerHill Homes / Yes on A&amp;amp;B&lt;/option&gt;
  &lt;/select&gt; 
  </code></pre>
  
  <p>Thanks a bunch for taking a look! Let me know if there's anything else I can add to make my question more clear.</p>