jQuery(function($){$('.lws_checkgrid_item').on('click',function(event){var me=$(event.currentTarget);if(me[0].wasDragged=='yes'){me[0].wasDragged=''}else{var active=me.find('.lws_cg_active');if(active.val()=="yes"){active.val('');me.removeClass('checked');me.find('.checkbox').removeClass('lws-icon-checkbox-checked').addClass('lws-icon-checkbox-unchecked')}else{active.val('yes');me.addClass('checked');me.find('.checkbox').removeClass('lws-icon-checkbox-unchecked').addClass('lws-icon-checkbox-checked')}}});$('.lws_checkgrid_sortable').each(function(){var me=$(this);var id=me.attr('id');me.sortable({revert:!0,});me.find('.lws_checkgrid_item').each(function(){$(this).draggable({connectToSortable:"#"+id,revert:"invalid",start:function(){this.wasDragged='yes'},})})})})