jQuery(document).ready(function($) { var abuAllSortableCounts = 0; $(".all-sortable").each(function(index, value) { $(this).children(".abu-sortable-list").sortable({ placeholder: 'ui-state-highlight', cursor: 'move', forceHelperSize: !0, forcePlaceholderSize: !0, update: function(event, ui) { var order = $(this).sortable('toArray'); var positions = order.join(','); var gettingInput = $(this).next('.abu-hideme').children('input'); gettingInput.val(positions).trigger('change').change(function() { // alert('You\'ve just Arrenged single Post Content One more time.') }) } }); abuAllSortableCounts = (index + 1) }); console.log('Total sortable Controls are : ' + abuAllSortableCounts); $(".abu-all-chosen").each(function(index, value) { $(this).children('.abu-choosdgen-select').chosen({ no_results_text: "Oops, nothing found!", width: "100%", }); $(this).children('.abu-choosdgen-select').trigger('chosen:updated'); $(this).on('change', function(evt, params) { var getInput = $(this).children('input.abu-chosen-input').val(); getInput = getInput.split(','); getInput[0] = $(this).children('input.abu-chosen-input').val(params.selected); console.log(params.selected) }); $(this).children('.abu-variants-select').trigger('chosen:updated'); $(this).on('change', function(evt, params) { var getInput = $(this).children('input.abu-chosen-input').val(); getInput = getInput.split(','); getInput[1] = $(this).children('input.abu-chosen-input').val(params.selected); console.log(params.selected) }) }) })