Skip to content

How do I submit the form when a checkbox/radio has been clicked? #93

@shannont

Description

@shannont

Hi guys :)

I'm really stupid at jQuery ...but I got prettycheckable working! The only problem is I want to submit the form when someone clicks a checkbox or a radio button, without the need to click the submit button.

How do I achieve this?

I tried:

 <script type"text/javascript">
$(":checkbox").click(function() {
  $(this).closest("form").submit();
});
</script>

or

<script type"text/javascript">
$(":checkbox").on('change', function() {
  $(this).closest("form").submit();
});
</script>

But neither is working. What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions