I want to submit a form whenever checkboxes are clicked (I already have ajax set up with Rails) - this means even if it gets unchecked. Also I never want the click handler to unbind, so a user can click a checkbox as many times and the form will get submitted each time.
$(":checkbox").click(function() {
$(this).closest("form").submit();
});
The above code works fine, but it stops working after the first click. How would I make it so that the above code will work even when a user clicks a checkbox more than once?
EDIT:
I am replacing the contents of the form (including the checkboxes) on submission of the form.