Created
November 1, 2012 00:08
-
-
Save frnhr/3990773 to your computer and use it in GitHub Desktop.
uncheckable radio buttons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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