title: Where do I have to put JQuery in Ruby On Rails?
body: <p>I am implementing in Ruby on Rails.What I want to do works with Jquery. What i want to do is just: I have a file_field_tag, to let the user upload a file, when the user selects a file, the submit button has been enabled. So the user can't click on the button as long as he didn't select a file.</p>
  
  <p>This is the JQuery which I've written</p>
  
  <pre><code>$(document).ready(
      function(){
          $('input:file').change(
              function(){
                  if ($(this).val()) {
                      $('input:submit').attr('disabled',false);
                      // or, as has been pointed out elsewhere:
                      // $('input:submit').removeAttr('disabled'); 
                  } 
              }
              );
      });
  </code></pre>
  
  <p>and my view looks like:</p>
  
  <pre><code>&lt;h2&gt;Import projects and users&lt;/h2&gt;
  
  
  &lt;% form_tag({:action =&gt; 'match'}, {:multipart =&gt; true, :id =&gt; 'file_form_id'}) do %&gt;
  &lt;fieldset title="File"&gt;
      &lt;legend&gt;File&lt;/legend&gt;
  &lt;table&gt;
     &lt;tr&gt;
       &lt;td&gt;
        &lt;label for="dump_file"&gt;
          Select a CSV File :
        &lt;/label&gt;
  
           &lt;/td&gt;
           &lt;td &gt;
             &lt;%= file_field_tag 'file', :size =&gt; 500 %&gt;&lt;/p&gt;
           &lt;/td&gt;
         &lt;/tr&gt;   
       &lt;/table&gt;
  
             &lt;%= submit_tag 'Submit', :disabled =&gt; true -%&gt;
  
  
      &lt;% end -%&gt;
  </code></pre>
  
  <p>I think that this is correct. But where do i have to put this javascript? I really don't know where to put it. I've read to put it in application.js, but when I do this, nothing happens. The button stays disabled. Somebody who knows what I am missing?</p>