Skip to content

Instantly share code, notes, and snippets.

@zviryatko
Created January 9, 2015 16:12
Show Gist options
  • Save zviryatko/4fb11d7cd338543d4588 to your computer and use it in GitHub Desktop.
Save zviryatko/4fb11d7cd338543d4588 to your computer and use it in GitHub Desktop.
Sisyphus.js don't save uncheckable radio buttons
(function($) {
$(document).ready() {
var $forms = $('form');
$forms.find(':radio').change(function() {
var sisyphus = Sisyphus.getInstance();
var name = $(this).attr("name");
var $form = $(this).parents('form');
if (!$form.find(':radio[name="' + name + '"]:checked').length) {
var prefix = (sisyphus.options.locationBased ? sisyphus.href : "") + $form.attr("id") + $form.attr("name") + name + sisyphus.options.customKeySuffix;
sisyphus.saveToBrowserStorage(prefix, '', false);
}
});
$forms.sisyphus();
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment