Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
uncheckable radio buttons
/**
* Uncheckable radio buttons o_O
*
* usage:
* <input type="radio" name="something" class="uncheckable" />
*/
$('input[type=radio].uncheckable').on('click', function(event){
var $this = $(this);
var was_checked = $this.data('checked');
$('input[name='+$this.prop('name')+']').data('checked', false);
$this.data('checked', !was_checked).prop('checked', !was_checked);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.