title: Disable submit button in coffeescript
body: <p>I have some date validation that I am doing that works well. In addition to displaying an error message when there is an invalid date range I would like to disable/enable the submit button. Here is my coffeescript...</p>
  
  <pre><code>jQuery -&gt;
    to_date = null
    from_date = null
    $("#to_date, #from_date").bind "change", -&gt;
      from_date = new Date($('#from_date').val())
      to_date = new Date($('#to_date').val())
      if from_date &gt; to_date
        $("#date_error").text("Error! Not a valid date range")
        $("#submit_button").attr("disabled", true)
      else
        $("#date_error").text("")
  </code></pre>
  
  <p>...and my html when I do view/source...</p>
  
  <pre><code>...
    &lt;div id="submit_button"&gt;
      &lt;input name="commit" type="submit" value="Create Orientation" /&gt;
    &lt;/div&gt;
  ...
  </code></pre>
  
  <p>I know my JS is loading cuz my error message is being displayed, no button disabled. Ideas?</p>