title: Form submit on jQuery click event only selecting very first form
body: <p>I have a todo/task list type of app built with Rails.</p>
  
  <p>I have a list of categories with their respective tasks below the name of the category. </p>
  
  <p>I have a checkbox next to each task that when I click it, I want the form for that particular task to submit and update the task to be either complete/imcomplete. I have a jQuery function to do this:</p>
  
  <pre><code>$(function(){
    $('input:checkbox').on('click', function(){
      $(this).parents('form').submit();
    });
  });
  </code></pre>
  
  <p>My form looks like this (in HAML):</p>
  
  <pre><code>- form_class = task.complete? ? "edit_task complete" : "edit_task"
  
  = form_for task, remote: true, html: {:class =&gt; form_class } do |f|
    = f.check_box :complete
    = f.label :complete, task.name
    = link_to task_path(task.id), remote: true, method: :delete, class: "delete-task" do
      %i.icon-remove.pull-right
  </code></pre>
  
  <p>The output HTML is this:</p>
  
  <pre><code>&lt;form accept-charset="UTF-8" action="/tasks/338" class="edit_task" data-remote="true" id="edit_task_338" method="post"&gt;
  &lt;div style="margin:0;padding:0;display:inline"&gt;
  &lt;input name="utf8" type="hidden" value="✓"&gt;
  &lt;input name="_method" type="hidden" value="put"&gt;
  &lt;input name="authenticity_token" type="hidden" value="q7bvSGPr1IDf1p2/SKsssbdiQj+NBWmg/C6zPB3x+jM="&gt;
  &lt;/div&gt;
  &lt;input name="task[complete]" type="hidden" value="0"&gt;
  &lt;input checked="checked" id="task_complete" name="task[complete]" type="checkbox" value="1"&gt;
  &lt;label class="338" for="task_complete" id="task-label"&gt;another task&lt;/label&gt;
  &lt;a href="/tasks/338" class="delete-task" data-method="delete" data-remote="true" rel="nofollow"&gt;
  &lt;i class="icon-remove pull-right"&gt;&lt;/i&gt;&lt;/a&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The problem is that when I click ANY checkbox, instead of finding that particular task's form, it only ever selects and toggles the very first task on the page. </p>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Thanks</p>