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
Post a Comment