Last active
August 29, 2015 14:27
-
-
Save brettsmason/8737ca49ec49b2a306d1 to your computer and use it in GitHub Desktop.
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
jQuery( document ).ready( function($) { | |
$( '.customize-control-checkbox-multiple > ul' ).sortable({ | |
handle: '.dashicons-menu', | |
axis: 'y', | |
stop: function( event, ui ) { | |
checkbox_values = $( this ).parents( '.customize-control' ).find( 'input[type="checkbox"]:checked' ).map( | |
function() { | |
return this.value; | |
} | |
).get().join( ',' ); | |
$( this ).parents( '.customize-control' ).find( 'input[type="text"]' ).val( checkbox_values ).trigger( 'change' ); | |
} | |
}); | |
/* === Checkbox Multiple Control === */ | |
$( '.customize-control-checkbox-multiple input[type="checkbox"]' ).on( | |
'change', | |
function() { | |
checkbox_values = $( this ).parents( '.customize-control' ).find( 'input[type="checkbox"]:checked' ).map( | |
function() { | |
return this.value; | |
} | |
).get().join( ',' ); | |
$( this ).parents( '.customize-control' ).find( 'input[type="checkbox"]' ).val( checkbox_values ).trigger( 'change' ); | |
} | |
); | |
} ); // $( document ).ready |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment