jQuery unset all checkboxes and radio buttons

This code snippet will clear all checkboxes and radio buttons in a form using a click event on a clear button.


<form id="my-form">
    <!--- form fields --->
    <input type="button" id="clear-form" value="Clear" />


    $('#clear-form').on('click', function()
        $('#my-form').find('input:radio, input:checkbox').prop('checked', false);

For clearing or resetting all form elements check out this post.

Sign Up
comments powered by Disqus

Popular Tags

Need a web developer?

If you'd like to work with code synthesis on your next project get in touch via the contact page.