title: jQuery .submit doesn't get called?
body: <p>I have the following function that is meant to get called after a form I submitted (this method is in my application.js folder in my rails app):</p>
  
  <pre><code>var addToTopics = function() {
      var result = "";
      var checkedTopics = $(".topic-checkbox:checked");
      $.each(checkedTopics, function(i, topic) {
          if(i == 0) {
              result = result + $(topic).attr('value');
          }
          else {
              result = result + ", " + $(topic).attr('value');
          }
      });
      return result;
  };
  
  
  $("#new_comment").submit(function() {
      var ListOfTopics = addToTopics();
      $('#comment_topics').val(ListOfTopics);
      alert($('#comment_topics').val());
      return true;
  
  });
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;form method="post" id="new_comment" class="new_comment" action="/comments" accept-charset="UTF-8"&gt;&lt;div style="margin:0;padding:0;display:inline"&gt;&lt;input type="hidden" value="✓" name="utf8"&gt;&lt;input type="hidden" value="8vLhtuco+TAkeB+9kQ0gERvA54BD/BnjJuguWxuXWHQ=" name="authenticity_token"&gt;&lt;/div&gt;
  
  
            &lt;div class="field"&gt;
              &lt;label for="comment_comment"&gt;Comment&lt;/label&gt;
              &lt;br&gt;
              &lt;textarea rows="20" name="comment[comment]" id="comment_comment" cols="40"&gt;&lt;/textarea&gt;
            &lt;/div&gt;
            &lt;div class="field"&gt;
              &lt;input type="hidden" value="28" name="comment[review_id]" id="comment_review_id"&gt;
            &lt;/div&gt;
            &lt;div class="field"&gt;
              &lt;input type="hidden" value="1" name="comment[user_id]" id="comment_user_id"&gt;
            &lt;/div&gt;
            &lt;div class="field"&gt;
              &lt;input type="hidden" value="" name="comment[topics]" id="comment_topics"&gt;
            &lt;/div&gt;
            &lt;div class="actions"&gt;
              &lt;input type="submit" value="Create Comment" name="commit" id="comment_submit"&gt;
            &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>But this dosen't seem to be getting called as the alert dosent even go off when I submit my form.</p>
  
  <p>Any idea why? Thanks </p>