javascript - Can't submit form on checkbox click with jQuery + Rails -



javascript - Can't submit form on checkbox click with jQuery + Rails -

i'm trying have each form submit when corresponding checkbox clicked. right can see click registers, no form submitted. code follows:

- @current_agency.tasks.active.each |task| = form_for task |f| %tr %td = f.check_box :completed, :class => "taskcheckbox" %td = task.name %td = task.due_at.to_date.strftime( "%m-%d-%y" ) = submit_tag 'save', class: 'btn btn-primary'

jquery:

$('.taskcheckbox').on('change', function() { $(this).closest('form').submit(); });

that should work... sounds off.

try debugging closest('form')?

you can explicitly form of input: $(this.form).submit() rather searching.

javascript jquery ruby-on-rails forms jquery-ui

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -