select2 destroy 1

select2 destroy

if ($('#mySelect2').hasClass("select2-hidden-accessible")) {
    // Select2 has been initialized
    $('#mySelect2').select2('destroy');
}

Here is what the above code is Doing:
1. Check if the select2 has been initialized.
2. If it has been initialized, destroy it.
3. Re-initialize it.

Similar Posts