title: How do you pass in the value from collection_select to onchange function in Rails?
body: <p>I'm trying to pass in the value selected from my collection_select drop down to an onchange function. When I do name, my value prints out as <em>source[index]</em>, but I want the value of this not that as the text itself.</p>
  
  <pre><code>&lt;%= collection_select(:source, :index, @sources, :id, :name, options = {include_blank: "Please select a source..."}, html_options = {:onchange =&gt; "updateTextArea(name)"}) %&gt;
  
  function updateTextArea(source){
   var value = source;
   console.log(value);
  }
  </code></pre>