Skip to content

Instantly share code, notes, and snippets.

@mick88
Last active May 9, 2016 14:50
Show Gist options
  • Save mick88/42aef3ae5b5bbed9ef288888c2bd4fa2 to your computer and use it in GitHub Desktop.
Save mick88/42aef3ae5b5bbed9ef288888c2bd4fa2 to your computer and use it in GitHub Desktop.
/**
* Radio select toggler
* enables radio buttons to be toggled when clicked
* Created by Michal on 09/05/2016.
*/
var radios = $('input[type=radio]');
/**
* Adds click listeners to all checkboxes to unselect checkbox if it was checked already
*/
function updateCheckboxes() {
radios.unbind('click');
radios.filter(':checked').click(function () {
$(this).prop('checked', false);
});
radios.click(function () {
updateCheckboxes();
});
}
updateCheckboxes();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment