Im using a simple select list and the jquery.dropkick library to make it beautiful. Now i want to change that dropkick content after the corresponding select element has been ch
I leveraged Diode's answer to modify the Dropkick code to make this a little cleaner:
// Reload the dropkick select widget after options have changed
// usage: $("...").dropkick('reload');
methods.reload = function () {
var $select = $(this);
var data = $select.data('dropkick');
$select.removeData("dropkick");
$("#dk_container_"+ data.id).remove();
$select.dropkick(data.settings);
};
Add the above code right after the following snippet in dropkick.js:
methods.reset = function () {
...
};
Then you can use it programatically:
$('#my-select').html("");
$('#my-select').dropkick('reload');