Skip to content

Instantly share code, notes, and snippets.

@royalsflush
Created December 3, 2012 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save royalsflush/4195753 to your computer and use it in GitHub Desktop.
Save royalsflush/4195753 to your computer and use it in GitHub Desktop.
//Based http://www.ilovecolors.com.ar/preserving-radio-button-checked-state-during-drag-and-drop-jquery/
$('#example').sortable({
(...)
start: function (e, ui) {
var radio_checked= {};
me.$el.find('input[type="radio"]', this).each(function(){
if($(this).is(':checked'))
radio_checked[$(this).attr('name')] = $(this).val();
$(document).data('radio_checked', radio_checked);
});
}
}).bind('sortstop', function (event, ui) {
var radio_restore = $(document).data('radio_checked');
$.each(radio_restore, function(index, value){
$('input[name="'+index+'"][value="'+value+'"]').prop('checked', true);
});
});
@amit-srivastava-007
Copy link

What is me.$el ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment