From 5be327d35e468c44e4263f82cae9e99f8c3bc190 Mon Sep 17 00:00:00 2001 From: Rada Bogdan Raul Date: Thu, 28 Jul 2016 10:58:05 +0300 Subject: [PATCH] fix enable and disable when selectbox destroyed --- jquery.selectBox.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/jquery.selectBox.js b/jquery.selectBox.js index e4c7b8f..98f5784 100755 --- a/jquery.selectBox.js +++ b/jquery.selectBox.js @@ -512,7 +512,7 @@ if (settings.styleClass) { options.addClass(settings.styleClass); } - + if (select.triggerHandler('beforeopen')) { return false; } @@ -1047,8 +1047,8 @@ setOptions : function (options) { var select = $(this) , control = select.data('selectBox-control'); - - + + switch (typeof(options)) { case 'string': select.html(options); @@ -1077,12 +1077,12 @@ // Refresh the control $(this).selectBox('refresh'); // Remove old options - + } }, - - - + + + selectBox: function (method, options) { var selectBox; @@ -1099,11 +1099,11 @@ break; case 'options': // Getter - + if (undefined === options) { return $(this).data('selectBox-control').data('selectBox-options'); } - + // Setter $(this).each(function () { $(this).setOptions(options); @@ -1132,6 +1132,9 @@ if (selectBox = $(this).data('selectBox')) { selectBox.enable(this); } + else{ + $(this).attr('disabled',false); + } }); break; case 'disable': @@ -1139,6 +1142,9 @@ if (selectBox = $(this).data('selectBox')) { selectBox.disable(); } + else{ + $(this).attr('disabled','disabled'); + } }); break; case 'destroy':